-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 822e933
Showing
14 changed files
with
872 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 10.00 | ||
# Visual C# Express 2008 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoViewer", "VideoViewer\VideoViewer.csproj", "{F14D2F8A-3F4C-4D58-8253-0EF1BF790094}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{F14D2F8A-3F4C-4D58-8253-0EF1BF790094}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{F14D2F8A-3F4C-4D58-8253-0EF1BF790094}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{F14D2F8A-3F4C-4D58-8253-0EF1BF790094}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{F14D2F8A-3F4C-4D58-8253-0EF1BF790094}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Application x:Class="VideoViewer.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
StartupUri="NavigationWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Windows; | ||
|
||
namespace VideoViewer | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<Window x:Class="VideoViewer.NavigationWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
Title="NavigationWindow" Height="300" Width="300" | ||
Closed="OnClosed"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="0.10*"/> | ||
<RowDefinition Height="0.45*"/> | ||
<RowDefinition Height="0.45*"/> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="0.10*"/> | ||
<ColumnDefinition Width="0.90*"/> | ||
</Grid.ColumnDefinitions> | ||
<Label Name="currentPathBar" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" FontSize="30.0" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Height="Auto"/> | ||
<Button Grid.Row="1" Grid.Column="0" FontSize="30.0" Click="OnUpButtonClick">Up</Button> | ||
<Button Grid.Row="2" Grid.Column="0" FontSize="30.0" Click="OnOptionsButtonClick">Options</Button> | ||
<ScrollViewer Grid.Row="1" Grid.Column="1" Grid.RowSpan="2"> | ||
<StackPanel Name="navigationPanel"/> | ||
</ScrollViewer> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
using Microsoft.Win32; | ||
using System.IO; | ||
using System.IO.IsolatedStorage; | ||
|
||
namespace VideoViewer | ||
{ | ||
/// <summary> | ||
/// Interaction logic for NavigationWindow.xaml | ||
/// </summary> | ||
public partial class NavigationWindow : Window | ||
{ | ||
public string AppPath { get; set; } | ||
private string _appPath; | ||
|
||
public string DefaultViewPath { get; set; } | ||
private string _defaultViewPath; | ||
|
||
public SolidColorBrush FolderBrush { get; set; } | ||
private SolidColorBrush _folderBrush; | ||
|
||
public SolidColorBrush FolderTextBrush { get; set; } | ||
private SolidColorBrush _folderTextBrush; | ||
|
||
public SolidColorBrush FileBrush { get; set; } | ||
private SolidColorBrush _fileBrush; | ||
|
||
public SolidColorBrush FileTextBrush { get; set; } | ||
private SolidColorBrush _fileTextBrush; | ||
|
||
public DirectoryInfo CurrentDir { get; set; } | ||
private DirectoryInfo _currentDir; | ||
|
||
public NavigationWindow() | ||
{ | ||
InitializeComponent(); | ||
|
||
IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForDomain(); | ||
string[] fileNames = storage.GetFileNames("config.txt"); | ||
if (fileNames.Length != 0) | ||
{ | ||
byte r, g, b; | ||
StreamReader reader = new StreamReader(new IsolatedStorageFileStream("config.txt", FileMode.Open, storage)); | ||
AppPath = reader.ReadLine(); | ||
DefaultViewPath = reader.ReadLine(); | ||
reader.ReadLine(); | ||
byte.TryParse(reader.ReadLine(), out r); | ||
byte.TryParse(reader.ReadLine(), out g); | ||
byte.TryParse(reader.ReadLine(), out b); | ||
FolderBrush = new SolidColorBrush(Color.FromRgb(r, g, b)); | ||
reader.ReadLine(); | ||
byte.TryParse(reader.ReadLine(), out r); | ||
byte.TryParse(reader.ReadLine(), out g); | ||
byte.TryParse(reader.ReadLine(), out b); | ||
FolderTextBrush = new SolidColorBrush(Color.FromRgb(r, g, b)); | ||
reader.ReadLine(); | ||
byte.TryParse(reader.ReadLine(), out r); | ||
byte.TryParse(reader.ReadLine(), out g); | ||
byte.TryParse(reader.ReadLine(), out b); | ||
FileBrush = new SolidColorBrush(Color.FromRgb(r, g, b)); | ||
reader.ReadLine(); | ||
byte.TryParse(reader.ReadLine(), out r); | ||
byte.TryParse(reader.ReadLine(), out g); | ||
byte.TryParse(reader.ReadLine(), out b); | ||
FileTextBrush = new SolidColorBrush(Color.FromRgb(r, g, b)); | ||
} | ||
else | ||
{ | ||
AppPath = "C:\\Program Files\\VideoLAN\\VLC\\vlc.exe"; | ||
DefaultViewPath = ""; | ||
FolderBrush = new SolidColorBrush(Colors.Aquamarine); | ||
FolderTextBrush = new SolidColorBrush(Colors.Black); | ||
FileBrush = new SolidColorBrush(Colors.White); | ||
FileTextBrush = new SolidColorBrush(Colors.Black); | ||
} | ||
|
||
this.WindowStartupLocation = WindowStartupLocation.CenterScreen; | ||
this.ResizeMode = ResizeMode.CanResize; | ||
this.WindowState = WindowState.Maximized; | ||
|
||
if (DefaultViewPath == "") | ||
{ | ||
System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog(); | ||
dlg.ShowDialog(); | ||
if (dlg.SelectedPath == "") Close(); | ||
activateDirectory(dlg.SelectedPath); | ||
|
||
} | ||
else | ||
activateDirectory(DefaultViewPath); | ||
} | ||
|
||
public void activateDirectory(string path) | ||
{ | ||
try | ||
{ | ||
DirectoryInfo NewDir = new DirectoryInfo(path); | ||
DirectoryInfo[] directories = NewDir.GetDirectories(); | ||
FileInfo[] files = NewDir.GetFiles(); | ||
navigationPanel.Children.Clear(); | ||
Button buttonToAdd; | ||
|
||
foreach (DirectoryInfo dinfo in directories) | ||
{ | ||
buttonToAdd = new Button(); | ||
buttonToAdd.Content = dinfo.Name; | ||
buttonToAdd.HorizontalContentAlignment = HorizontalAlignment.Left; | ||
buttonToAdd.FontWeight = FontWeights.Heavy; | ||
buttonToAdd.FontSize = 50.0; | ||
buttonToAdd.Background = FolderBrush; | ||
buttonToAdd.Foreground = FolderTextBrush; | ||
buttonToAdd.Click += OnButtonClick; | ||
navigationPanel.Children.Add(buttonToAdd); | ||
} | ||
|
||
foreach (FileInfo finfo in files) | ||
{ | ||
buttonToAdd = new Button(); | ||
buttonToAdd.Content = finfo.Name; | ||
buttonToAdd.HorizontalContentAlignment = HorizontalAlignment.Left; | ||
buttonToAdd.FontSize = 50.0; | ||
buttonToAdd.Background = FileBrush; | ||
buttonToAdd.Foreground = FileTextBrush; | ||
buttonToAdd.Click += OnButtonClick; | ||
navigationPanel.Children.Add(buttonToAdd); | ||
} | ||
} | ||
catch (UnauthorizedAccessException e) | ||
{ | ||
MessageBox.Show("You can't access that directory", "Error", MessageBoxButton.OK, MessageBoxImage.Information); | ||
return; | ||
} | ||
catch (DirectoryNotFoundException e) | ||
{ | ||
MessageBox.Show("The directory can't be found", "Error", MessageBoxButton.OK, MessageBoxImage.Information); | ||
return; | ||
} | ||
catch (Exception e) | ||
{ | ||
MessageBox.Show(e.Message); | ||
return; | ||
} | ||
|
||
CurrentDir = new DirectoryInfo(path); | ||
currentPathBar.Content = CurrentDir.FullName; | ||
} | ||
|
||
protected void OnButtonClick(object sender, RoutedEventArgs args) | ||
{ | ||
if (((Button)sender).FontWeight == FontWeights.Heavy) | ||
activateDirectory(CurrentDir.FullName + "\\" + ((Button)sender).Content); | ||
else | ||
{ | ||
System.Diagnostics.Process.Start(AppPath, "\"" + CurrentDir + "\\" + ((Button)sender).Content + "\""); | ||
} | ||
} | ||
|
||
protected void OnUpButtonClick(object sender, RoutedEventArgs args) | ||
{ | ||
if (CurrentDir.Parent != null) | ||
activateDirectory(CurrentDir.Parent.FullName); | ||
} | ||
|
||
protected void OnClosed(object sender, EventArgs args) | ||
{ | ||
IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForDomain(); | ||
StreamWriter writer = new StreamWriter(new IsolatedStorageFileStream("config.txt", FileMode.Create, storage)); | ||
writer.WriteLine(AppPath); | ||
writer.WriteLine(DefaultViewPath); | ||
writer.WriteLine("Folder Background (RGB)"); | ||
writer.WriteLine(FolderBrush.Color.R); | ||
writer.WriteLine(FolderBrush.Color.G); | ||
writer.WriteLine(FolderBrush.Color.B); | ||
writer.WriteLine("Folder Text (RGB)"); | ||
writer.WriteLine(FolderTextBrush.Color.R); | ||
writer.WriteLine(FolderTextBrush.Color.G); | ||
writer.WriteLine(FolderTextBrush.Color.B); | ||
writer.WriteLine("File Background (RGB)"); | ||
writer.WriteLine(FileBrush.Color.R); | ||
writer.WriteLine(FileBrush.Color.G); | ||
writer.WriteLine(FileBrush.Color.B); | ||
writer.WriteLine("File Text (RGB)"); | ||
writer.WriteLine(FileTextBrush.Color.R); | ||
writer.WriteLine(FileTextBrush.Color.G); | ||
writer.WriteLine(FileTextBrush.Color.B); | ||
writer.Close(); | ||
} | ||
|
||
private void OnOptionsButtonClick(object sender, RoutedEventArgs e) | ||
{ | ||
OptionsWindow options = new OptionsWindow(AppPath, DefaultViewPath, FolderBrush, FolderTextBrush, FileBrush, FileTextBrush); | ||
options.ShowDialog(); | ||
|
||
AppPath = options.AppPath; | ||
DefaultViewPath = options.DefaultViewPath; | ||
FolderBrush = options.FolderBrush; | ||
FolderTextBrush = options.FolderTextBrush; | ||
FileBrush = options.FileBrush; | ||
FileTextBrush = options.FileTextBrush; | ||
|
||
activateDirectory(CurrentDir.FullName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Window x:Class="VideoViewer.OptionsWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
Title="Options" Height="216" Width="560" | ||
WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" | ||
ResizeMode="NoResize"> | ||
<StackPanel Margin="5"> | ||
<StackPanel Orientation="Horizontal" Margin="5"> | ||
<Label MinWidth="100" HorizontalContentAlignment="Right">Folder Color</Label> | ||
<Button Name="FolderButton" Width="100" Background="{Binding FolderBrush}" Click="OnFolderButtonClick"></Button> | ||
<Label MinWidth="100" HorizontalContentAlignment="Right">Folder Text Color</Label> | ||
<Button Name="FolderTextButton" Width="100" Background="{Binding FolderTextBrush}" Click="OnFolderTextButtonClick"></Button> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Margin="5"> | ||
<Label MinWidth="100" HorizontalContentAlignment="Right">File Color</Label> | ||
<Button Name="FileButton" Width="100" Background="{Binding FileBrush}" Click="OnFileButtonClick"></Button> | ||
<Label MinWidth="100" HorizontalContentAlignment="Right">File Text Color</Label> | ||
<Button Name="FileTextButton" Width="100" Background="{Binding FileTextBrush}" Click="OnFileTextButtonClick"></Button> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Margin="5"> | ||
<Label MinWidth="100" HorizontalContentAlignment="Right">Launching App</Label> | ||
<TextBox Name="AppPathTextBox" Width="400"></TextBox> | ||
<Button MinWidth="25" Click="OnAppPathClick">...</Button> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" Margin="5"> | ||
<Label MinWidth="100" HorizontalContentAlignment="Right">Default Folder</Label> | ||
<TextBox Name="DefaultViewPathTextBox" Width="400"></TextBox> | ||
<Button MinWidth="25" Click="OnDefaultFolderButtonClick">...</Button> | ||
</StackPanel> | ||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> | ||
<Button Margin="5" Width="50" Height="30" Click="OnOKClick">OK</Button> | ||
</StackPanel> | ||
</StackPanel> | ||
</Window> |
Oops, something went wrong.