diff options
| author | Michael <[email protected]> | 2017-02-13 09:05:25 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-13 09:05:25 -0500 |
| commit | e8dfafa17a492bdba99151379d5d4926c267dde5 (patch) | |
| tree | bdc21f8c028e03f987920d581c0aaad3b1168938 /ShiftOS.Wpf/Applications | |
| parent | 14bd25bab6dbed116c194d392e887c68a90c4d73 (diff) | |
| download | shiftos_thereturn-e8dfafa17a492bdba99151379d5d4926c267dde5.tar.gz shiftos_thereturn-e8dfafa17a492bdba99151379d5d4926c267dde5.tar.bz2 shiftos_thereturn-e8dfafa17a492bdba99151379d5d4926c267dde5.zip | |
ugh more debugging
Diffstat (limited to 'ShiftOS.Wpf/Applications')
| -rw-r--r-- | ShiftOS.Wpf/Applications/FileDialog.xaml | 29 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/FileDialog.xaml.cs | 309 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/FileSkimmer.xaml | 20 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs | 324 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/Infobox.xaml | 13 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/Infobox.xaml.cs | 87 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/MainWindow.xaml | 10 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/MainWindow.xaml.cs | 203 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml | 24 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs | 164 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/SkinLoader.xaml | 75 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/SkinLoader.xaml.cs | 200 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/TextPad.xaml | 17 | ||||
| -rw-r--r-- | ShiftOS.Wpf/Applications/TextPad.xaml.cs | 114 |
14 files changed, 0 insertions, 1589 deletions
diff --git a/ShiftOS.Wpf/Applications/FileDialog.xaml b/ShiftOS.Wpf/Applications/FileDialog.xaml deleted file mode 100644 index bdf3253..0000000 --- a/ShiftOS.Wpf/Applications/FileDialog.xaml +++ /dev/null @@ -1,29 +0,0 @@ -<UserControl x:Class="ShiftOS.Wpf.Applications.FileDialog" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:ShiftOS.Wpf.Applications" - mc:Ignorable="d" - Height="400" Width="650"> - <DockPanel LastChildFill="True"> - <WrapPanel Style="{DynamicResource Toolbar}" DockPanel.Dock="Top"> - <Button Style="{DynamicResource ToolbarButton}" x:Name="newFolder">New Folder</Button> - <Button Style="{DynamicResource ToolbarButton}" x:Name="deleteSelected">Delete</Button> - </WrapPanel> - <DockPanel LastChildFill="True" DockPanel.Dock="Bottom"> - <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">Filename: </TextBlock> - <DockPanel LastChildFill="True" DockPanel.Dock="Right"> - <Button DockPanel.Dock="Right" x:Name="btnconfirm" Click="btnconfirm_Click" Style="{DynamicResource ToolbarButton}">Open</Button> - <ComboBox Width="75" x:Name="filter" SelectionChanged="filter_SelectionChanged"></ComboBox> - - </DockPanel> - <TextBox x:Name="txtfilename"></TextBox> - </DockPanel> - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> - <WrapPanel x:Name="lbfiles"> - - </WrapPanel> - </ScrollViewer> - </DockPanel> -</UserControl> diff --git a/ShiftOS.Wpf/Applications/FileDialog.xaml.cs b/ShiftOS.Wpf/Applications/FileDialog.xaml.cs deleted file mode 100644 index edeff65..0000000 --- a/ShiftOS.Wpf/Applications/FileDialog.xaml.cs +++ /dev/null @@ -1,309 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -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 ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// <summary> - /// Interaction logic for FileDialog.xaml - /// </summary> - public partial class FileDialog : UserControl, IShiftOSWindow - { - public FileDialog(string[] filters, FileOpenerStyle style, Action<string> callback) - { - InitializeComponent(); - Filters = filters; - OpenerStyle = style; - Callback = callback; - } - - public string[] Filters { get; set; } - public FileOpenerStyle OpenerStyle { get; set; } - public Action<string> Callback { get; set; } - - private string currentFolder = "0:"; - - public void OnLoad() - { - Reset(); - foreach(var f in Filters) - { - filter.Items.Add(f); - } - filter.SelectedIndex = 0; - } - - public string GetParent(string path) - { - string[] pathlist = path.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); - if (pathlist.Length > 1) - { - if (path.EndsWith("/")) - { - path = path.Remove(path.Length - 1, 1); - } - path = path.Remove(path.LastIndexOf('/'), path.Length - path.LastIndexOf('/')); - return path; - } - else - { - return "__system"; - } - } - - public void Reset() - { - if (currentFolder != "__system") - this.SetTitle("File Skimmer - " + currentFolder); - else - this.SetTitle("File Skimmer"); - - lbfiles.Children.Clear(); - if (currentFolder == "__system") - { - foreach (var dir in Utils.Mounts) - { - var sp = new StackPanel(); - sp.Width = 50; - sp.Margin = new Thickness(5); - var label = new TextBlock(); - label.Text = dir.Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(Utils.Mounts.IndexOf(dir) + ":").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(Utils.Mounts.IndexOf(dir) + ":"); - } - }; - - lbfiles.Children.Add(sp); - - } - } - else - { - var __up = CreateUpOneDirectory(); - lbfiles.Children.Add(__up); - - foreach (var dir in Utils.GetDirectories(currentFolder)) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetDirectoryInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(dir); - } - }; - - lbfiles.Children.Add(sp); - - } - - foreach (var dir in Utils.GetFiles(currentFolder)) - { - if (dir.EndsWith(filter.SelectedItem.ToString())) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetFileInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - if(OpenerStyle == FileOpenerStyle.Open) - { - Callback?.Invoke(dir); - AppearanceManager.Close(this); - } - } - else - { - txtfilename.Text = Utils.GetFileInfo(dir).Name; - } - }; - - lbfiles.Children.Add(sp); - } - } - } - } - - public void ChangeDirectory(string path) - { - currentFolder = path; - Reset(); - } - - private StackPanel CreateUpOneDirectory() - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = "Up one directory"; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage("__upone").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - GoUp(); - } - }; - - return sp; - } - - public void GoUp() - { - if (currentFolder.EndsWith(":")) - { - currentFolder = "__system"; - Reset(); - } - else - { - currentFolder = GetParent(currentFolder); - Reset(); - } - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - - } - - - private void btnconfirm_Click(object sender, RoutedEventArgs e) - { - if (!string.IsNullOrWhiteSpace(txtfilename.Text)) - { - if (!txtfilename.Text.EndsWith(filter.SelectedItem.ToString())) - txtfilename.Text += filter.SelectedItem.ToString(); - - switch (OpenerStyle) - { - case FileOpenerStyle.Open: - if(Utils.FileExists(currentFolder + "/" + txtfilename.Text)) - { - Callback?.Invoke(currentFolder + "/" + txtfilename.Text); - AppearanceManager.Close(this); - } - else - { - Infobox.Show("File not found", $"The file {currentFolder}/{txtfilename.Text} was not found."); - } - break; - case FileOpenerStyle.Save: - Callback?.Invoke(currentFolder + "/" + txtfilename.Text); - AppearanceManager.Close(this); - break; - } - } - else - { - Infobox.Show("File Skimmer", "Please provide a filename."); - } - } - - private void filter_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - Reset(); - } - } -} diff --git a/ShiftOS.Wpf/Applications/FileSkimmer.xaml b/ShiftOS.Wpf/Applications/FileSkimmer.xaml deleted file mode 100644 index ae4f435..0000000 --- a/ShiftOS.Wpf/Applications/FileSkimmer.xaml +++ /dev/null @@ -1,20 +0,0 @@ -<UserControl x:Class="ShiftOS.Wpf.Applications.FileSkimmer" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:ShiftOS.Wpf.Applications" - mc:Ignorable="d" - Height="400" Width="650"> - <DockPanel LastChildFill="True"> - <WrapPanel Style="{DynamicResource Toolbar}" DockPanel.Dock="Top"> - <Button Style="{DynamicResource ToolbarButton}" x:Name="newFolder">New Folder</Button> - <Button Style="{DynamicResource ToolbarButton}" x:Name="deleteSelected">Delete</Button> - </WrapPanel> - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"> - <WrapPanel x:Name="lbfiles"> - - </WrapPanel> - </ScrollViewer> - </DockPanel> -</UserControl> diff --git a/ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs b/ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs deleted file mode 100644 index 51021c0..0000000 --- a/ShiftOS.Wpf/Applications/FileSkimmer.xaml.cs +++ /dev/null @@ -1,324 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -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 ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// <summary> - /// Interaction logic for FileSkimmer.xaml - /// </summary> - [Launcher("File Skimmer", true, "al_file_skimmer")] - [RequiresUpgrade("file_skimmer")] - public partial class FileSkimmer : UserControl, IShiftOSWindow - { - public FileSkimmer() - { - InitializeComponent(); - } - - private string currentFolder = "0:"; - - static FileSkimmer() - { - FileSkimmerBackend.Init(new WpfFSFrontend()); - } - - public void OnLoad() - { - Reset(); - } - - public string GetParent(string path) - { - string[] pathlist = path.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries); - if (pathlist.Length > 1) - { - if (path.EndsWith("/")) - { - path = path.Remove(path.Length - 1, 1); - } - path = path.Remove(path.LastIndexOf('/'), path.Length - path.LastIndexOf('/')); - return path; - } - else - { - return "__system"; - } - } - - public void Reset() - { - if (currentFolder != "__system") - this.SetTitle("File Skimmer - " + currentFolder); - else - this.SetTitle("File Skimmer"); - - lbfiles.Children.Clear(); - if (currentFolder == "__system") - { - foreach(var dir in Utils.Mounts) - { - var sp = new StackPanel(); - sp.Width = 50; - sp.Margin = new Thickness(5); - var label = new TextBlock(); - label.Text = dir.Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(Utils.Mounts.IndexOf(dir) + ":").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(Utils.Mounts.IndexOf(dir) + ":"); - } - }; - - lbfiles.Children.Add(sp); - - } - } - else - { - var __up = CreateUpOneDirectory(); - lbfiles.Children.Add(__up); - - foreach(var dir in Utils.GetDirectories(currentFolder)) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetDirectoryInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - ChangeDirectory(dir); - } - }; - - lbfiles.Children.Add(sp); - - } - - foreach(var dir in Utils.GetFiles(currentFolder)) - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = Utils.GetFileInfo(dir).Name; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage(dir).ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if (a.ClickCount == 2) - { - FileSkimmerBackend.OpenFile(dir); - } - }; - - lbfiles.Children.Add(sp); - - } - } - } - - public void ChangeDirectory(string path) - { - currentFolder = path; - Reset(); - } - - private StackPanel CreateUpOneDirectory() - { - var sp = new StackPanel(); - sp.Margin = new Thickness(5); - sp.Width = 50; - var label = new TextBlock(); - label.Text = "Up one directory"; - label.TextWrapping = TextWrapping.Wrap; - label.TextAlignment = TextAlignment.Center; - - var img = new Image(); - img.Width = 42; - img.Height = 42; - img.Source = FileSkimmerBackend.GetImage("__upone").ToBitmapImage(); - - sp.Children.Add(img); - sp.Children.Add(label); - - sp.PreviewMouseLeftButtonDown += (o, a) => - { - if(a.ClickCount == 2) - { - GoUp(); - } - }; - - return sp; - } - - public void GoUp() - { - if (currentFolder.EndsWith(":")) - { - currentFolder = "__system"; - Reset(); - } - else - { - currentFolder = GetParent(currentFolder); - Reset(); - } - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - - } - } - - public class WpfFSFrontend : IFileSkimmer - { - public void GetPath(string[] filetypes, FileOpenerStyle style, Action<string> callback) - { - AppearanceManager.SetupDialog(new FileDialog(filetypes, style, callback)); - } - - public void OpenDirectory(string path) - { - var fs = new FileSkimmer(); - fs.ChangeDirectory(path); - AppearanceManager.SetupWindow(fs); - } - - public void OpenFile(string path) - { - bool opened = true; - - string ext = path.Split('.')[path.Split('.').Length - 1]; - switch(ext) - { - case "txt": - if (Shiftorium.UpgradeInstalled("textpad_open")) - { - var txt = new TextPad(); - txt.LoadFile(path); - AppearanceManager.SetupWindow(txt); - } - else - { - opened = false; - } - break; - case "pic": - case "png": - case "jpg": - case "bmp": - - break; - case "wav": - case "mp3": - - break; - case "lua": - - break; - case "py": - - break; - case "skn": - - break; - case "mfs": - Utils.MountPersistent(path); - string mount = (Utils.Mounts.Count - 1).ToString() + ":"; - OpenDirectory(mount); - break; - default: - opened = false; - break; - } - if(opened == false) - { - Infobox.Show("File Skimmer - Can't open file", "File Skimmer can't find an application to open this file!"); - } - } - } -} diff --git a/ShiftOS.Wpf/Applications/Infobox.xaml b/ShiftOS.Wpf/Applications/Infobox.xaml deleted file mode 100644 index e2ad454..0000000 --- a/ShiftOS.Wpf/Applications/Infobox.xaml +++ /dev/null @@ -1,13 +0,0 @@ -<UserControl x:Class="ShiftOS.Wpf.Applications.Infobox" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:ShiftOS.Wpf.Applications" - mc:Ignorable="d" - Height="300" Width="475"> - <Grid> - <TextBlock x:Name="txtmessage" VerticalAlignment="Center" HorizontalAlignment="Center">Message goes here.</TextBlock> - <Button x:Name="btnokay" Click="btnokay_Click" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="5">OK</Button> - </Grid> -</UserControl> diff --git a/ShiftOS.Wpf/Applications/Infobox.xaml.cs b/ShiftOS.Wpf/Applications/Infobox.xaml.cs deleted file mode 100644 index 1786f6e..0000000 --- a/ShiftOS.Wpf/Applications/Infobox.xaml.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -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 ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// <summary> - /// Interaction logic for Infobox.xaml - /// </summary> - public partial class Infobox : UserControl, IShiftOSWindow - { - public Infobox(string title, string msg) - { - InitializeComponent(); - Title = title; - Message = msg; - } - - public static void Show(string title, string msg) - { - ShiftOS.Engine.Infobox.Show(title, msg); - } - - public string Title { get; set; } - public string Message { get; set; } - - public void OnLoad() - { - this.SetTitle(Title); - txtmessage.Text = Message; - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - - private void btnokay_Click(object sender, RoutedEventArgs e) - { - AppearanceManager.Close(this); - } - } -} diff --git a/ShiftOS.Wpf/Applications/MainWindow.xaml b/ShiftOS.Wpf/Applications/MainWindow.xaml deleted file mode 100644 index 22b992f..0000000 --- a/ShiftOS.Wpf/Applications/MainWindow.xaml +++ /dev/null @@ -1,10 +0,0 @@ -<UserControl x:Class="ShiftOS.Wpf.Terminal" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:ShiftOS.Wpf" - mc:Ignorable="d" - Height="350" Width="525"> - <TextBox GotFocus="txtterm_GotFocus" x:Name="txtterm" AcceptsReturn="True" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontFamily="Lucida Console" FontSize="9" Foreground="White" Background="Black" IsManipulationEnabled="True" PreviewKeyDown="txtterm_KeyDown" BorderThickness="0"/> -</UserControl>
\ No newline at end of file diff --git a/ShiftOS.Wpf/Applications/MainWindow.xaml.cs b/ShiftOS.Wpf/Applications/MainWindow.xaml.cs deleted file mode 100644 index c76acec..0000000 --- a/ShiftOS.Wpf/Applications/MainWindow.xaml.cs +++ /dev/null @@ -1,203 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -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 ShiftOS.Engine; -using backend = ShiftOS.Engine.TerminalBackend; - -namespace ShiftOS.Wpf -{ - /// <summary> - /// Interaction logic for MainWindow.xaml - /// </summary> - [Launcher("Terminal", false)] - public partial class Terminal : UserControl, IShiftOSWindow - { - public Terminal() - { - InitializeComponent(); - Startup.ConsoleOut = this.txtterm; - - if (SaveSystem.CurrentSave == null) - { - Startup.InitiateEngine(new WpfTerminalTextWriter()); - SaveSystem.GameReady += () => - { - try - { - Dispatcher.Invoke(new Action(() => - { - txtterm.Text = ""; - backend.PrefixEnabled = true; - backend.InStory = false; - if (SaveSystem.CurrentSave.StoryPosition != 8) - { - Story.RunFromInternalResource("sys_shiftoriumstory"); - SaveSystem.CurrentSave.StoryPosition = 8; - } - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); - txtterm.Background = SkinEngine.LoadedSkin.TerminalBackColor.CreateBrush(); - txtterm.Foreground = SkinEngine.LoadedSkin.TerminalForeColor.CreateBrush(); - txtterm.SetFont(SkinEngine.LoadedSkin.TerminalFont); - })); - } - catch { } - }; - } - else - { - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); - } - txtterm.Background = SkinEngine.LoadedSkin.TerminalBackColor.CreateBrush(); - txtterm.Foreground = SkinEngine.LoadedSkin.TerminalForeColor.CreateBrush(); - - txtterm.GotFocus += (o, a) => - { - Startup.ConsoleOut = txtterm; - }; - - txtterm.Focus(); - - } - - public void OnLoad() - { - this.SetTitle("Terminal"); - } - - public void OnSkinLoad() - { - txtterm.SetFont(SkinEngine.LoadedSkin.TerminalFont); - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - - public void txtterm_KeyDown(object o, KeyEventArgs a) { - if (a.Key == Key.Enter) - { - try - { - a.Handled = true; - var text2 = txtterm.GetLineText(txtterm.LineCount - 1); - Console.WriteLine(""); - var text3 = ""; - var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); - - if (backend.PrefixEnabled) - { - text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); - } - backend.LastCommand = text3; - if (backend.InStory == false) - { - backend.InvokeCommand(text3); - } - if (backend.PrefixEnabled) - { - Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); - } - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - else if (a.Key == Key.Back) - { - var tostring3 = txtterm.GetLineText(txtterm.LineCount - 1); - var tostringlen = tostring3.Length + 1; - var workaround = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var derp = workaround.Length + 1; - if (tostringlen != derp) - { - AppearanceManager.CurrentPosition--; - } - else - { - a.Handled = true; - } - } - else if (a.Key == Key.Left) - { - var getstring = txtterm.GetLineText(txtterm.LineCount - 1); - var stringlen = getstring.Length + 1; - var header = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var headerlen = header.Length + 1; - var selstart = txtterm.SelectionStart; - var remstrlen = txtterm.Text.Length - stringlen; - var finalnum = selstart - remstrlen; - - if (finalnum != headerlen) - { - AppearanceManager.CurrentPosition--; - } - else - { - a.Handled = true; - } - } - //( ͡° ͜ʖ ͡° ) You found the lennyface without looking at the commit message. Message Michael in the #shiftos channel on Discord saying "ladouceur" somewhere in your message if you see this. - else if (a.Key == Key.Up) - { - var tostring3 = txtterm.GetLineText(txtterm.LineCount - 1); - if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") - Console.Write(backend.LastCommand); - a.Handled = true; - - } - else - { - - AppearanceManager.CurrentPosition++; - } - - } - - private void txtterm_GotFocus(object sender, RoutedEventArgs e) - { - Startup.ConsoleOut = txtterm; - } - } -} diff --git a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml b/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml deleted file mode 100644 index f2d0df1..0000000 --- a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml +++ /dev/null @@ -1,24 +0,0 @@ -<UserControl x:Class="ShiftOS.Wpf.Applications.ShiftoriumFrontend" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:ShiftOS.Wpf.Applications" - mc:Ignorable="d" - Height="300" Width="700"> - <DockPanel> - <DockPanel DockPanel.Dock="Left" Width="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="10"> - <TextBlock DockPanel.Dock="Top" Margin="15" Foreground="White" HorizontalAlignment="Center">Upgrades</TextBlock> - <TextBlock x:Name="codepointDisplay" DockPanel.Dock="Bottom" Margin="15" Foreground="White">Codepoints: <TextBlock x:Name="currentcodepoints">0</TextBlock></TextBlock> - <ListBox SelectionChanged="lbupgrades_SelectionChanged" x:Name="lbupgrades" HorizontalAlignment="Stretch" Margin="10" Width="300"></ListBox> - </DockPanel> - <DockPanel Grid.Column="2" VerticalAlignment="Stretch" Margin="15"> - <TextBlock x:Name="title" HorizontalAlignment="Center" DockPanel.Dock="Top" Margin="15" Foreground="White"></TextBlock> - <DockPanel DockPanel.Dock="Bottom" HorizontalAlignment="Stretch"> - <Button Click="btnbuy_Click_1" x:Name="btnbuy" DockPanel.Dock="Right" VerticalAlignment="Center" Width="Auto">Buy</Button> - <TextBlock VerticalAlignment="Center" Foreground="White">Cost: <TextBlock x:Name="cost">{Binding Cost}</TextBlock> CP</TextBlock> - </DockPanel> - <TextBlock x:Name="description" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" Margin="5" TextAlignment="Center" Foreground="White">{Binding Description}</TextBlock> - </DockPanel> - </DockPanel> -</UserControl> diff --git a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs b/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs deleted file mode 100644 index 8effa7c..0000000 --- a/ShiftOS.Wpf/Applications/ShiftoriumFrontend.xaml.cs +++ /dev/null @@ -1,164 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Timers; -using System.Threading.Tasks; -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 ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// <summary> - /// Interaction logic for ShiftoriumFrontend.xaml - /// </summary> - [Launcher("Shiftorium", true, "al_shiftorium")] - [RequiresUpgrade("shiftorium_gui")] - public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow - { - public ShiftoriumFrontend() - { - InitializeComponent(); - this.DataContextChanged += (o, a) => - { - if (this.DataContext is ShiftoriumUpgrade) - { - var upg = this.DataContext as ShiftoriumUpgrade; - title.Text = upg.Name; - this.SetTitle("Shiftorium - " + upg.Name); - description.Text = upg.Description; - cost.Text = upg.Cost.ToString(); - } - }; - this.DataContext = new ShiftoriumUpgrade - { - Name = "Welcome to the Shiftorium", - Description = @"The Shiftorium is an application that lets you buy upgrades for ShiftOS using Codepoints. - -Upgrades can be anything from new apps, to games, to system enhancements, to eyecandy, to anything else. Just be careful! The best thing to do is to buy new ways of earning Codepoints otherwise you'll find yourself unable to earn Codepoints later on.", - Cost = 0, - Dependencies = null - }; - } - - public void Setup() - { - lbupgrades.Items.Clear(); - - foreach(var itm in Shiftorium.GetAvailable()) - { - lbupgrades.Items.Add(itm.Name); - } - } - - public void OnLoad() - { - this.SetTitle("Shiftorium"); - var t = new Timer(); - t.Interval = 500; - t.Elapsed += (o,a) => - { - try - { - currentcodepoints.Text = SaveSystem.CurrentSave.Codepoints.ToString(); - } - catch { t.Stop(); } - - }; - t.Start(); - - lbupgrades.SelectionChanged += (o, a) => - { - try - { - btnbuy.Visibility = Visibility.Visible; - this.DataContext = GetUpgradeFromName(lbupgrades.SelectedItem.ToString()); - } - catch - { - - } - }; - - btnbuy.Visibility = Visibility.Collapsed; - Setup(); - } - - public ShiftoriumUpgrade GetUpgradeFromName(string upg) - { - foreach(var upgrade in Shiftorium.GetDefaults()) - { - if (upgrade.Name == upg) - return upgrade; - } - return null; - } - - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - codepointDisplay.Upgrade("shiftorium_gui_cp_display"); - } - - private void lbupgrades_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - - } - - private void btnbuy_Click_1(object sender, RoutedEventArgs e) - { - var upg = this.DataContext as ShiftoriumUpgrade; - Shiftorium.Silent = true; - if(Shiftorium.Buy(upg.ID, upg.Cost) == true) - { - btnbuy.Visibility = Visibility.Collapsed; - Setup(); - } - else - { - Infobox.Show("Shiftorium", $"You do not have enough Codepoints to buy this upgrade. You need {upg.Cost - SaveSystem.CurrentSave.Codepoints} more."); - } - } - } -} diff --git a/ShiftOS.Wpf/Applications/SkinLoader.xaml b/ShiftOS.Wpf/Applications/SkinLoader.xaml deleted file mode 100644 index 48b0f6d..0000000 --- a/ShiftOS.Wpf/Applications/SkinLoader.xaml +++ /dev/null @@ -1,75 +0,0 @@ -<UserControl x:Class="ShiftOS.Wpf.Applications.SkinLoader" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:ShiftOS.Wpf.Applications" - mc:Ignorable="d" - Height="400" Width="700"> - <DockPanel LastChildFill="True"> - <WrapPanel Height="Auto" DockPanel.Dock="Bottom"> - <Button x:Name="close" Click="close_Click">Close</Button> - <Button x:Name="loaddefault" Click="loaddefault_Click">Load default</Button> - <Button x:Name="import" Click="import_Click">Import</Button> - <Button x:Name="export" Click="export_Click">Export</Button> - <Button x:Name="apply" Click="apply_Click">Apply</Button> - </WrapPanel> - - <Canvas DockPanel.Dock="Top" Background="{DynamicResource desktoppanelbg}" Name="desktoppanel" Height="{DynamicResource desktoppanelheight}" HorizontalAlignment="Stretch" VerticalAlignment="{DynamicResource desktoppanelpos}"> - - - <Button Click="apps_Click" Width="100" Height="24" Name="apps"> - <TextBlock Text="Applications"> - - </TextBlock> - </Button> - </Canvas> - - <Canvas x:Name="windowlayer"> - <StackPanel x:Name="appsmenu" Canvas.Left="0" Canvas.Top="0" Background="White" Width="100" Visibility="Hidden"></StackPanel> - - <DockPanel Canvas.Left="50" Canvas.Top="50" Width="300" Height="300"> - <Grid DockPanel.Dock="Top" x:Name="titlemaster" Height="30" HorizontalAlignment="Stretch" VerticalAlignment="Top"> - <Canvas x:Name="titleleft" HorizontalAlignment="Left" Background="Gray" Width="2"></Canvas> - <Canvas x:Name="titlebar" HorizontalAlignment="Stretch" Background="Gray"> - <TextBlock x:Name="titletext" VerticalAlignment="Center" Foreground="White" Height="Auto" HorizontalAlignment="Stretch" FontFamily="Tahoma" FontSize="18">Template</TextBlock> - <Button Width="24" Height="24" x:Name="closebtn" Background="Red" Canvas.Left="266" Canvas.Top="6"/> - <Button Width="24" Height="24" x:Name="max" Background="green" Canvas.Left="239" Canvas.Top="4" RenderTransformOrigin="0.5,0.5"> - - </Button> - <Button Width="24" Height="24" x:Name="min" Background="yellow" Canvas.Left="212" Canvas.Top="3"/> - - </Canvas> - <Canvas x:Name="titleright" HorizontalAlignment="Right" Background="Gray" Width="2"></Canvas> - - </Grid> - <DockPanel x:Name="bottommaster" DockPanel.Dock="Bottom" Height="2" HorizontalAlignment="Stretch"> - <Canvas DockPanel.Dock="Left" x:Name="borderbottoml" HorizontalAlignment="Left" Background="Red" Width="2"> - - </Canvas> - <Canvas DockPanel.Dock="Right" x:Name="borderbottomr" HorizontalAlignment="Right" Background="Red" Width="2" Grid.Column="1"> - - </Canvas> - <Canvas x:Name="borderbottom" Background="Red" HorizontalAlignment="Stretch" Grid.ColumnSpan="2"> - - </Canvas> - - </DockPanel> - <DockPanel Height="Auto" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> - <Canvas DockPanel.Dock="Left" x:Name="borderleft" HorizontalAlignment="Left" Background="Red" Width="2"> - - </Canvas> - <Canvas DockPanel.Dock="Right" x:Name="borderright" HorizontalAlignment="Right" Background="Red" Width="2"> - - </Canvas> - <UserControl x:Name="pgcontents" Background="White" HorizontalAlignment="Stretch"> - - </UserControl> - - </DockPanel> - - </DockPanel> - - </Canvas> - </DockPanel> -</UserControl> diff --git a/ShiftOS.Wpf/Applications/SkinLoader.xaml.cs b/ShiftOS.Wpf/Applications/SkinLoader.xaml.cs deleted file mode 100644 index 4360893..0000000 --- a/ShiftOS.Wpf/Applications/SkinLoader.xaml.cs +++ /dev/null @@ -1,200 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -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 Newtonsoft.Json; -using ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// <summary> - /// Interaction logic for SkinLoader.xaml - /// </summary> - [Launcher("Skin Loader", true, "al_skin_loader")] - [RequiresUpgrade("skinning")] - public partial class SkinLoader : UserControl, IShiftOSWindow - { - public SkinLoader() - { - InitializeComponent(); - } - - private Skin _mySkin = new Skin(); - - private void close_Click(object sender, RoutedEventArgs e) - { - AppearanceManager.Close(this); - } - - private void loaddefault_Click(object sender, RoutedEventArgs e) - { - _mySkin = new Skin(); - Setup(); - } - - private void import_Click(object sender, RoutedEventArgs e) - { - - } - - private void export_Click(object sender, RoutedEventArgs e) - { - - } - - public void Setup() - { - SetupWindowUpgradeables(); - SetupWindowSkin(); - } - - public void SetupWindowSkin() - { - if (_mySkin.ShowTitleCorners) - { - titleleft.Visibility = Visibility.Visible; - titleright.Visibility = Visibility.Visible; - } - else - { - titleleft.Visibility = Visibility.Hidden; - titleright.Visibility = Visibility.Hidden; - } - - pgcontents.Background = _mySkin.ControlColor.CreateBrush(); - pgcontents.Foreground = _mySkin.ControlTextColor.CreateBrush(); - - - titlemaster.Height = _mySkin.TitlebarHeight; - if (_mySkin.TitleTextCentered == true) - { - titletext.SetValue(Canvas.LeftProperty, (double)(titlemaster.ActualWidth - titletext.ActualWidth) / 2); - titletext.SetValue(Canvas.TopProperty, (double)_mySkin.TitleTextLeft.Y); - } - else - { - titletext.SetValue(Canvas.LeftProperty, (double)_mySkin.TitleTextLeft.X); - titletext.SetValue(Canvas.TopProperty, (double)_mySkin.TitleTextLeft.Y); - } - - titletext.SetFont(_mySkin.TitleFont); - - titletext.Foreground = _mySkin.TitleTextColor.CreateBrush(); - - titlebar.Background = _mySkin.TitleBackgroundColor.CreateBrush(); - - close.SetValue(Canvas.LeftProperty, this.ActualWidth - _mySkin.CloseButtonSize.Width - _mySkin.CloseButtonFromSide.X); - close.SetValue(Canvas.TopProperty, (double)_mySkin.CloseButtonFromSide.Y); - - min.SetValue(Canvas.LeftProperty, this.ActualWidth - _mySkin.MinimizeButtonSize.Width - _mySkin.MinimizeButtonFromSide.X); - min.SetValue(Canvas.TopProperty, (double)_mySkin.MinimizeButtonFromSide.Y); - - max.SetValue(Canvas.LeftProperty, this.ActualWidth - _mySkin.MaximizeButtonSize.Width - _mySkin.MaximizeButtonFromSide.X); - max.SetValue(Canvas.TopProperty, (double)_mySkin.MaximizeButtonFromSide.Y); - - close.Background = _mySkin.CloseButtonColor.CreateBrush(); - min.Background = _mySkin.MinimizeButtonColor.CreateBrush(); - max.Background = _mySkin.MaximizeButtonColor.CreateBrush(); - - close.BorderThickness = new Thickness(0.0); - min.BorderThickness = new Thickness(0.0); - max.BorderThickness = new Thickness(0.0); - - borderleft.Background = _mySkin.BorderLeftBackground.CreateBrush(); - borderright.Background = _mySkin.BorderRightBackground.CreateBrush(); - borderbottom.Background = _mySkin.BorderBottomBackground.CreateBrush(); - borderbottoml.Background = _mySkin.BorderBottomLeftBackground.CreateBrush(); - borderbottomr.Background = _mySkin.BorderBottomRightBackground.CreateBrush(); - - borderleft.Width = _mySkin.LeftBorderWidth; - borderright.Width = _mySkin.RightBorderWidth; - bottommaster.Height = _mySkin.BottomBorderWidth; - - } - - - public void SetupWindowUpgradeables() - { - close.Upgrade("close_button"); - max.Upgrade("maximize_button"); - min.Upgrade("minimize_button"); - - titlemaster.Upgrade("wm_titlebar"); - - borderleft.Upgrade("wm_free_placement"); - borderright.Upgrade("wm_free_placement"); - borderbottom.Upgrade("wm_free_placement"); - borderbottoml.Upgrade("wm_free_placement"); - borderbottomr.Upgrade("wm_free_placement"); - - - } - - - private void apply_Click(object sender, RoutedEventArgs e) - { - Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(_mySkin)); - SkinEngine.LoadSkin(); - } - - public void OnLoad() - { - this.SetTitle("Skin Loader"); - _mySkin = JsonConvert.DeserializeObject<Skin>(JsonConvert.SerializeObject(SkinEngine.LoadedSkin)); - } - - public void OnSkinLoad() - { - Setup(); - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - - public void apps_Click(object s, RoutedEventArgs a) - { - - } - } -} diff --git a/ShiftOS.Wpf/Applications/TextPad.xaml b/ShiftOS.Wpf/Applications/TextPad.xaml deleted file mode 100644 index 2097be3..0000000 --- a/ShiftOS.Wpf/Applications/TextPad.xaml +++ /dev/null @@ -1,17 +0,0 @@ -<UserControl x:Class="ShiftOS.Wpf.Applications.TextPad" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:ShiftOS.Wpf.Applications" - mc:Ignorable="d" - Height="400" Width="600"> - <DockPanel LastChildFill="True"> - <WrapPanel Style="{DynamicResource Toolbar}" DockPanel.Dock="Top"> - <Button x:Name="btnnew" Click="btnnew_Click" Style="{DynamicResource ToolbarButton}">New</Button> - <Button x:Name="btnopen" Click="btnopen_Click" Style="{DynamicResource ToolbarButton}">Open</Button> - <Button x:Name="btnsave" Click="btnsave_Click" Style="{DynamicResource ToolbarButton}">Save</Button> - </WrapPanel> - <TextBox AcceptsReturn="True" x:Name="txtbody"></TextBox> - </DockPanel> -</UserControl> diff --git a/ShiftOS.Wpf/Applications/TextPad.xaml.cs b/ShiftOS.Wpf/Applications/TextPad.xaml.cs deleted file mode 100644 index 3438906..0000000 --- a/ShiftOS.Wpf/Applications/TextPad.xaml.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -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 ShiftOS.Objects.ShiftFS; -using ShiftOS.Engine; - -namespace ShiftOS.Wpf.Applications -{ - /// <summary> - /// Interaction logic for TextPad.xaml - /// </summary> - [Launcher("TextPad", true, "al_textpad")] - [RequiresUpgrade("textpad")] - public partial class TextPad : UserControl, IShiftOSWindow - { - public TextPad() - { - InitializeComponent(); - } - - private void btnnew_Click(object sender, RoutedEventArgs e) - { - txtbody.Text = ""; - } - - private void btnsave_Click(object sender, RoutedEventArgs e) - { - string filters = ".txt"; - if (Shiftorium.UpgradeInstalled("textpad_lua_support")) - filters += ";.lua"; - if (Shiftorium.UpgradeInstalled("textpad_python_support")) - filters += ";.py"; - - FileSkimmerBackend.GetFile(filters.Split(';'), FileOpenerStyle.Save, new Action<string>((file) => SaveFile(file))); - } - - private void btnopen_Click(object sender, RoutedEventArgs e) - { - string filters = ".txt"; - if (Shiftorium.UpgradeInstalled("textpad_lua_support")) - filters += ";.lua"; - if (Shiftorium.UpgradeInstalled("textpad_python_support")) - filters += ";.py"; - - FileSkimmerBackend.GetFile(filters.Split(';'), FileOpenerStyle.Open, new Action<string>((file) => LoadFile(file))); - - } - - public void LoadFile(string path) - { - txtbody.Text = Utils.ReadAllText(path); - } - - public void SaveFile(string path) - { - Utils.WriteAllText(path, txtbody.Text); - } - - public void OnLoad() - { - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { -/* btnnew.Upgrade("textpad_new"); - btnopen.Upgrade("textpad_open"); - btnsave.Upgrade("textpad_save"); -*/ } - } -} |
