Skip to content

Commit 960ff67

Browse files
Add files via upload
1 parent 0b4fef2 commit 960ff67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+19143
-0
lines changed

JohnBauerPictureViewer/App.xaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Application
2+
x:Class="JohnBauerPictureViewer.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:JohnBauerPictureViewer"
6+
RequestedTheme="Light">
7+
8+
</Application>

JohnBauerPictureViewer/App.xaml.cs

+185
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using JohnBauerPictureViewer.Classes;
7+
using Windows.ApplicationModel;
8+
using Windows.ApplicationModel.Activation;
9+
using Windows.Foundation;
10+
using Windows.Foundation.Collections;
11+
using Windows.UI.Xaml;
12+
using Windows.UI.Xaml.Controls;
13+
using Windows.UI.Xaml.Controls.Primitives;
14+
using Windows.UI.Xaml.Data;
15+
using Windows.UI.Xaml.Input;
16+
using Windows.UI.Xaml.Media;
17+
using Windows.UI.Xaml.Navigation;
18+
using Spree.Classes;
19+
using Windows.UI.Xaml.Media.Imaging;
20+
using System.Threading.Tasks;
21+
using Windows.Storage;
22+
using Windows.Storage.Streams;
23+
24+
namespace JohnBauerPictureViewer
25+
{
26+
/// <summary>
27+
/// Provides application-specific behavior to supplement the default Application class.
28+
/// </summary>
29+
sealed partial class App : Application
30+
{
31+
/// <summary>
32+
/// Initializes the singleton application object. This is the first line of authored code
33+
/// executed, and as such is the logical equivalent of main() or WinMain().
34+
/// </summary>
35+
public App()
36+
{
37+
this.InitializeComponent();
38+
this.Suspending += OnSuspending;
39+
}
40+
41+
public static ImageFileData ApplicationData { get; internal set; }
42+
43+
44+
45+
/// <summary>
46+
/// Invoked when the application is launched normally by the end user. Other entry points
47+
/// will be used such as when the application is launched to open a specific file.
48+
/// </summary>
49+
/// <param name="e">Details about the launch request and process.</param>
50+
protected override void OnLaunched(LaunchActivatedEventArgs e)
51+
{
52+
#if DEBUG
53+
if (System.Diagnostics.Debugger.IsAttached)
54+
{
55+
this.DebugSettings.EnableFrameRateCounter = true;
56+
}
57+
#endif
58+
Frame rootFrame = Window.Current.Content as Frame;
59+
60+
// Do not repeat app initialization when the Window already has content,
61+
// just ensure that the window is active
62+
if (rootFrame == null)
63+
{
64+
// Create a Frame to act as the navigation context and navigate to the first page
65+
rootFrame = new Frame();
66+
67+
rootFrame.NavigationFailed += OnNavigationFailed;
68+
69+
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
70+
{
71+
//TODO: Load state from previously suspended application
72+
}
73+
74+
// Place the frame in the current Window
75+
Window.Current.Content = rootFrame;
76+
}
77+
78+
if (e.PrelaunchActivated == false)
79+
{
80+
if (rootFrame.Content == null)
81+
{
82+
// When the navigation stack isn't restored navigate to the first page,
83+
// configuring the new page by passing required information as a navigation
84+
// parameter
85+
rootFrame.Navigate(typeof(MainPage), e.Arguments);
86+
}
87+
// Ensure the current window is active
88+
Window.Current.Activate();
89+
}
90+
}
91+
92+
/// <summary>
93+
/// Invoked when Navigation to a certain page fails
94+
/// </summary>
95+
/// <param name="sender">The Frame which failed navigation</param>
96+
/// <param name="e">Details about the navigation failure</param>
97+
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
98+
{
99+
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
100+
}
101+
102+
/// <summary>
103+
/// Invoked when application execution is being suspended. Application state is saved
104+
/// without knowing whether the application will be terminated or resumed with the contents
105+
/// of memory still intact.
106+
/// </summary>
107+
/// <param name="sender">The source of the suspend request.</param>
108+
/// <param name="e">Details about the suspend request.</param>
109+
private void OnSuspending(object sender, SuspendingEventArgs e)
110+
{
111+
var deferral = e.SuspendingOperation.GetDeferral();
112+
//TODO: Save application state and stop any background activity
113+
deferral.Complete();
114+
}
115+
116+
private static Settings _Settings;
117+
public static Settings Settings { get { if (_Settings == null) { _Settings = new Settings(); } return _Settings; } }
118+
119+
public static StorageFolder PictureStorageFolder { get { return KnownFolders.PicturesLibrary; } }
120+
public static StorageFolder VideoStorageFolder { get { return KnownFolders.VideosLibrary; } }
121+
public static StorageFolder MusicStorageFolder { get { return KnownFolders.MusicLibrary; } }
122+
123+
public static string WatchoutIP { get; set; }
124+
public static string WatchoutPort { get; set; }
125+
public static string Show1 { get; set; }
126+
public static string Show2 { get; set; }
127+
public static string Que1 { get; set; }
128+
public static string Que2 { get; set; }
129+
public static string Que3 { get; set; }
130+
public static int PauseMilliseconds { get; set; }
131+
public static int NumberOfPicturesToSearchFor { get { return 5; } }
132+
133+
private static async Task<bool> isFilePresent(StorageFolder storageFolder, string fileName)
134+
{
135+
try
136+
{
137+
var item = await storageFolder.TryGetItemAsync(fileName);
138+
if (item != null)
139+
{
140+
var prop = await item.GetBasicPropertiesAsync();
141+
var size = prop.Size;
142+
143+
return size > 0;
144+
}
145+
}
146+
catch (Exception E)
147+
{
148+
149+
}
150+
return false;
151+
}
152+
private static async Task<BitmapImage> StorageFileToBitmapImage(StorageFile savedStorageFile)//, RoutedEventHandler bitmapImage_ImageOpened)
153+
{
154+
using (IRandomAccessStream fileStream = await savedStorageFile.OpenAsync(Windows.Storage.FileAccessMode.Read))
155+
{
156+
BitmapImage bitmapImage = new BitmapImage();
157+
//bitmapImage.DecodePixelHeight = 100;
158+
//bitmapImage.DecodePixelWidth = 100;
159+
//bitmapImage.ImageOpened += bitmapImage_ImageOpened;
160+
161+
await bitmapImage.SetSourceAsync(fileStream);
162+
163+
164+
return bitmapImage;
165+
}
166+
}
167+
168+
169+
public static async Task<BitmapImage> GetBitmapImage(string FileName)//, RoutedEventHandler bitmapImage_ImageOpened)
170+
{
171+
StorageFolder storageFolder = PictureStorageFolder;
172+
173+
if (await isFilePresent(storageFolder, FileName))
174+
{
175+
StorageFile file = await storageFolder.GetFileAsync(FileName);
176+
177+
BitmapImage B = await StorageFileToBitmapImage(file);//, bitmapImage_ImageOpened);
178+
179+
return B;
180+
}
181+
return null;
182+
}
183+
184+
}
185+
}
Loading
Loading
Loading
Loading
Loading
1.42 KB
Loading
Loading
21.8 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MainPackage=D:\dev\John Bauer\JohnBauerPictureViewer\bin\x64\Debug\JohnBauerPictureViewer_1.0.10.0_x64_Debug.appx
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace JohnBauerPictureViewer.Classes
8+
{
9+
public class CSVTextParser
10+
{
11+
internal static List<List<string>> ParseText(string text)
12+
{
13+
List<List<string>> Result = new List<List<string>>();
14+
15+
if (!string.IsNullOrWhiteSpace(text))
16+
{
17+
while (!string.IsNullOrWhiteSpace(text))
18+
{
19+
string Row = GetOneRow(ref text);
20+
21+
List<string> RowData = ParseRow(Row);
22+
23+
Result.Add(RowData);
24+
}
25+
}
26+
return Result;
27+
}
28+
29+
private static List<string> ParseRow(string row)
30+
{
31+
List<string> Result = new List<string>();
32+
33+
string[] fields = row.Split(',');
34+
35+
foreach (var item in fields)
36+
{
37+
Result.Add(item);
38+
}
39+
return Result;
40+
}
41+
42+
private static string GetOneRow(ref string text)
43+
{
44+
string Result = "";
45+
if (!string.IsNullOrWhiteSpace(text))
46+
{
47+
bool FoundRowEnd = false;
48+
while ((!string.IsNullOrWhiteSpace(text)) && (!FoundRowEnd))
49+
{
50+
char NextChar = text[0];
51+
52+
if (NextChar == '\n')
53+
{
54+
FoundRowEnd = true;
55+
}
56+
else
57+
{
58+
Result += NextChar;
59+
}
60+
text = text.Substring(1);
61+
}
62+
}
63+
return Result;
64+
}
65+
}
66+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace JohnBauerPictureViewer.Classes
8+
{
9+
public class Category
10+
{
11+
public int ListColumn { get; set; }
12+
//public int MainCategoryColumn { get; set; }
13+
//public string MainCategoryName { get; set; }
14+
public string Name { get; set; }
15+
16+
}
17+
}

0 commit comments

Comments
 (0)