ugh more debugging
This commit is contained in:
parent
14bd25bab6
commit
e8dfafa17a
46 changed files with 13 additions and 3938 deletions
|
@ -7,7 +7,7 @@
|
|||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net451" />
|
||||
</packages>
|
|
@ -49,8 +49,8 @@
|
|||
<HintPath>..\packages\Nancy.Hosting.Self.1.4.1\lib\net40\Nancy.Hosting.Self.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
<package id="Nancy.Authentication.Forms" version="1.4.1" targetFramework="net452" />
|
||||
<package id="Nancy.Authentication.Stateless" version="1.4.1" targetFramework="net452" />
|
||||
<package id="Nancy.Hosting.Self" version="1.4.1" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
</packages>
|
|
@ -40,8 +40,8 @@
|
|||
<Reference Include="NetSockets">
|
||||
<HintPath>..\Libraries\NetSockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Nito.AsyncEx, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<packages>
|
||||
<package id="Discord.Net" version="0.9.6" targetFramework="net451" />
|
||||
<package id="DynamicLua" version="1.1.2.0" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net451" />
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net451" />
|
||||
<package id="Nito.AsyncEx" version="3.0.1" targetFramework="net451" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net451" />
|
||||
<package id="WebSocket4Net" version="0.14.1" targetFramework="net451" />
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
|
@ -1,60 +0,0 @@
|
|||
<Application x:Class="ShiftOS.Wpf.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ShiftOS.Wpf"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
StartupUri="Desktop.xaml"
|
||||
Startup="Application_Startup"
|
||||
Exit="Application_Exit">
|
||||
|
||||
<Application.Resources>
|
||||
<SolidColorBrush x:Key="desktoppanelbg" Color="Gray"></SolidColorBrush>
|
||||
<sys:Double x:Key="desktoppanelheight">24</sys:Double>
|
||||
<VerticalAlignment x:Key="desktoppanelpos">Bottom</VerticalAlignment>
|
||||
<ObjectDataProvider x:Key="desktopbackground" ObjectType="{x:Type local:SkinFrontend}" MethodName="GetDesktopBrush"></ObjectDataProvider>
|
||||
<Binding ElementName="This" Source="{StaticResource desktopbackground}" Path="" UpdateSourceTrigger="PropertyChanged" x:Key="desktopbackgroundbind"></Binding>
|
||||
|
||||
<Style x:Key="ShiftedListBox" TargetType="ListBox">
|
||||
<Setter Property="Padding" Value="5"/>
|
||||
<Setter Property="Background" Value="{DynamicResource TerminalBG}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TerminalFG}"/>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style TargetType="WrapPanel" x:Key="Toolbar">
|
||||
<Setter Property="Background" Value="{DynamicResource MenuBG}"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="Button" x:Key="ToolbarButton">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource MenuItemPressed}"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource MenuItemPressedText}"></Setter>
|
||||
</Trigger>
|
||||
|
||||
|
||||
</Style.Triggers>
|
||||
<Setter Property="Width" Value="Auto"></Setter>
|
||||
<Setter Property="Height" Value="Auto"></Setter>
|
||||
<Setter Property="BorderThickness" Value="0"></Setter>
|
||||
<Setter Property="FocusVisualStyle">
|
||||
<Setter.Value>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Background" Value="{DynamicResource MenuItemHover}"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource MenuItemHoverText}"></Setter>
|
||||
</Style>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Visibility" Value="Visible"></Setter>
|
||||
<Setter Property="Margin" Value="3"></Setter>
|
||||
<Setter Property="Background" Value="{DynamicResource MenuItem}"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource MenuItemText}"></Setter>
|
||||
|
||||
</Style>
|
||||
|
||||
<Style TargetType="ListBox">
|
||||
<Setter Property="Background" Value="{DynamicResource TerminalBG}"></Setter>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TerminalFG}"></Setter>
|
||||
</Style>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -1,83 +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.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
private void Application_Exit(object sender, ExitEventArgs e)
|
||||
{
|
||||
global::ShiftOS.Wpf.Startup.DestroyShiftOSEngine();
|
||||
}
|
||||
|
||||
private void Application_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
SkinEngine.SkinLoaded += () =>
|
||||
{
|
||||
Resources["desktoppanelbg"] = SkinEngine.LoadedSkin.DesktopPanelColor.CreateBrush();
|
||||
Resources["desktoppanelheight"] = (double)SkinEngine.LoadedSkin.DesktopPanelHeight;
|
||||
switch (SkinEngine.LoadedSkin.DesktopPanelPosition)
|
||||
{
|
||||
case 0:
|
||||
Resources["desktoppanelpos"] = VerticalAlignment.Top;
|
||||
break;
|
||||
case 1:
|
||||
Resources["desktoppanelpos"] = VerticalAlignment.Bottom;
|
||||
break;
|
||||
}
|
||||
|
||||
Resources["MenuBG"] = SkinEngine.LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush();
|
||||
|
||||
Resources["MenuItem"] = SkinEngine.LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush();
|
||||
Resources["MenuItemText"] = SkinEngine.LoadedSkin.Menu_TextColor.CreateBrush();
|
||||
|
||||
Resources["MenuItemPressed"] = SkinEngine.LoadedSkin.Menu_MenuItemPressedGradientBegin.CreateBrush();
|
||||
Resources["MenuItemPressedText"] = SkinEngine.LoadedSkin.Menu_SelectedTextColor.CreateBrush();
|
||||
|
||||
Resources["MenuItemHover"] = SkinEngine.LoadedSkin.Menu_MenuItemSelectedGradientBegin.CreateBrush();
|
||||
Resources["MenuItemHoverText"] = SkinEngine.LoadedSkin.Menu_SelectedTextColor.CreateBrush();
|
||||
|
||||
|
||||
Resources["MainBackColor"] = SkinEngine.LoadedSkin.ControlColor.CreateBrush();
|
||||
Resources["MainForeColor"] = SkinEngine.LoadedSkin.ControlTextColor.CreateBrush();
|
||||
Resources["TerminalBG"] = SkinEngine.LoadedSkin.TerminalBackColor.CreateBrush();
|
||||
Resources["TerminalFG"] = SkinEngine.LoadedSkin.TerminalForeColor.CreateBrush();
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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>
|
|
@ -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");
|
||||
*/ }
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
<Window x:Class="ShiftOS.Wpf.Desktop"
|
||||
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"
|
||||
Title="Desktop" Height="720" Width="1280"
|
||||
WindowStyle="None" ResizeMode="NoResize" Topmost="True" WindowState="Maximized"
|
||||
Loaded="Window_Loaded">
|
||||
<DockPanel>
|
||||
<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" Background="Black">
|
||||
<StackPanel x:Name="appsmenu" Canvas.Left="0" Canvas.Top="0" Background="White" Width="100" Visibility="Hidden"></StackPanel>
|
||||
</Canvas>
|
||||
|
||||
</DockPanel>
|
||||
|
||||
|
||||
</Window>
|
|
@ -1,225 +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.Reflection;
|
||||
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.Shapes;
|
||||
using ShiftOS.Engine;
|
||||
using static ShiftOS.Engine.SkinEngine;
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for Desktop.xaml
|
||||
/// </summary>
|
||||
public partial class Desktop : Window
|
||||
{
|
||||
public Desktop()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetupUpgradeable();
|
||||
Shiftorium.Installed += () => SetupUpgradeable();
|
||||
SaveSystem.GameReady += () =>
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
SetupDesktop();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public void SetupUpgradeable()
|
||||
{
|
||||
desktoppanel.Upgrade("desktop");
|
||||
apps.Upgrade("app_launcher");
|
||||
}
|
||||
|
||||
public void SetupDesktop()
|
||||
{
|
||||
windowlayer.Background = LoadedSkin.DesktopColor.CreateBrush();
|
||||
try
|
||||
{
|
||||
windowlayer.Background = new ImageBrush(LoadedSkin.DesktopBackgroundImage.ToBitmapImage());
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
desktoppanel.Background = LoadedSkin.DesktopPanelColor.CreateBrush();
|
||||
try
|
||||
{
|
||||
desktoppanel.Background = new ImageBrush(LoadedSkin.DesktopPanelBackground.ToBitmapImage());
|
||||
}
|
||||
catch { }
|
||||
|
||||
apps.Background = LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush();
|
||||
apps.Content = LoadedSkin.AppLauncherText;
|
||||
apps.Foreground = LoadedSkin.Menu_TextColor.CreateBrush();
|
||||
|
||||
PopulateAppLauncher();
|
||||
|
||||
SetupUpgradeable();
|
||||
}
|
||||
|
||||
private static event Action<WpfWindowBorder> onWindowShow;
|
||||
private static event Action<WpfWindowBorder> onWindowClose;
|
||||
|
||||
public static void ShowWindow(WpfWindowBorder brdr)
|
||||
{
|
||||
|
||||
onWindowShow?.Invoke(brdr);
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SaveSystem.GameReady += () => Dispatcher.Invoke(() => PopulateAppLauncher());
|
||||
Shiftorium.Installed += () => Dispatcher.Invoke(() => PopulateAppLauncher());
|
||||
SkinEngine.SkinLoaded += () => Dispatcher.Invoke(() => PopulateAppLauncher());
|
||||
|
||||
|
||||
onWindowShow += (brdr) =>
|
||||
{
|
||||
brdr.Measure(windowlayer.DesiredSize);
|
||||
brdr.SetValue(System.Windows.Controls.Canvas.LeftProperty, (windowlayer.ActualWidth - brdr.Width) / 2);
|
||||
brdr.SetValue(System.Windows.Controls.Canvas.TopProperty, (windowlayer.ActualHeight - brdr.ActualActualHeight) / 2);
|
||||
windowlayer.Children.Add(brdr);
|
||||
brdr.PreviewMouseDown += (o, a) =>
|
||||
{
|
||||
brdr.BringToFront(windowlayer);
|
||||
};
|
||||
};
|
||||
onWindowClose += (brdr) =>
|
||||
{
|
||||
if (windowlayer.Children.Contains(brdr))
|
||||
{
|
||||
windowlayer.Children.Remove(brdr);
|
||||
brdr.ParentWindow.OnUnload();
|
||||
brdr = null;
|
||||
}
|
||||
};
|
||||
AppearanceManager.SetupWindow(new Terminal());
|
||||
}
|
||||
|
||||
|
||||
public static void RemoveWindow(WpfWindowBorder brdr)
|
||||
{
|
||||
onWindowClose?.Invoke(brdr);
|
||||
}
|
||||
|
||||
public void PopulateAppLauncher()
|
||||
{
|
||||
appsmenu.Children.Clear();
|
||||
|
||||
double biggestWidth = 0;
|
||||
|
||||
appsmenu.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush();
|
||||
|
||||
foreach (var kv in AppLauncherDaemon.Available())
|
||||
{
|
||||
var item = new Button();
|
||||
if (kv.LaunchType.BaseType == typeof(System.Windows.Forms.UserControl))
|
||||
item.Content = kv.DisplayData.Name + " (Legacy)";
|
||||
else
|
||||
item.Content = kv.DisplayData.Name;
|
||||
item.Margin = new Thickness(2);
|
||||
double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
|
||||
if (measure > biggestWidth)
|
||||
biggestWidth = measure;
|
||||
item.Click += (o, a) =>
|
||||
{
|
||||
AppearanceManager.SetupWindow(Activator.CreateInstance(kv.LaunchType) as IShiftOSWindow);
|
||||
appsmenu.Visibility = Visibility.Hidden;
|
||||
};
|
||||
item.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||
appsmenu.Children.Add(item);
|
||||
}
|
||||
|
||||
if (Shiftorium.UpgradeInstalled("al_shutdown"))
|
||||
{
|
||||
var item = new Button();
|
||||
item.Content = ShiftOS.Engine.Localization.Parse("{SHUTDOWN}");
|
||||
item.Margin = new Thickness(2);
|
||||
double measure = item.Content.ToString().Measure(LoadedSkin.MainFont);
|
||||
if (measure > biggestWidth)
|
||||
biggestWidth = measure;
|
||||
|
||||
|
||||
item.Click += (o, a) =>
|
||||
{
|
||||
TerminalBackend.InvokeCommand("sos.shutdown");
|
||||
};
|
||||
appsmenu.Children.Add(item);
|
||||
|
||||
}
|
||||
|
||||
appsmenu.Width = biggestWidth + 50;
|
||||
|
||||
SkinAppLauncher();
|
||||
}
|
||||
|
||||
public void SkinAppLauncher()
|
||||
{
|
||||
apps.Background = LoadedSkin.Menu_MenuStripGradientBegin.CreateBrush();
|
||||
apps.Foreground = LoadedSkin.Menu_TextColor.CreateBrush();
|
||||
apps.BorderThickness = new Thickness(0.0);
|
||||
|
||||
appsmenu.Height = 0;
|
||||
|
||||
foreach (Control app in appsmenu.Children)
|
||||
{
|
||||
app.Background = LoadedSkin.Menu_ToolStripDropDownBackground.CreateBrush();
|
||||
app.Foreground = LoadedSkin.Menu_TextColor.CreateBrush();
|
||||
app.BorderThickness = new Thickness(0.0);
|
||||
app.HorizontalContentAlignment = HorizontalAlignment.Left;
|
||||
app.SetMouseOverStyle("menuitem");
|
||||
appsmenu.Height += app.Height;
|
||||
}
|
||||
}
|
||||
|
||||
private void apps_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (appsmenu.Visibility == Visibility.Hidden)
|
||||
{
|
||||
appsmenu.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
appsmenu.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
<UserControl x:Class="ShiftOS.Wpf.OOBE"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
Height="480" Width="720" Background="Black" Foreground="White">
|
||||
<TabControl BorderThickness="0" x:Name="tabControl" SelectedItem="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<TabItem BorderThickness="0" Header="Welcome" Visibility="Collapsed">
|
||||
<StackPanel Background="Black">
|
||||
<TextBlock Foreground="White" FontSize="20" Margin="5" TextAlignment="Center">Welcome to ShiftOS.</TextBlock>
|
||||
|
||||
<TextBlock Foreground="White" TextAlignment="Center" FontSize="15" TextWrapping="Wrap">You have been selected to be part of the testing and development of an experimental operating system named ShiftOS.
|
||||
<LineBreak/>
|
||||
<LineBreak/>
|
||||
This wizard will guide you through the process of setting up ShiftOS.
|
||||
<LineBreak/>
|
||||
<LineBreak/>
|
||||
<TextBlock FontSize="20">First: Select your language.</TextBlock>
|
||||
</TextBlock>
|
||||
<ListBox SelectionChanged="lblanguages_SelectionChanged" Background="#44FFFFFF" Foreground="White" Style="{DynamicResource ShiftedListBox}" Margin="15" x:Name="lblanguages">
|
||||
|
||||
</ListBox>
|
||||
<StackPanel x:Name="userInfo" Visibility="Collapsed">
|
||||
<TextBlock FontSize="20" Foreground="White" TextAlignment="Center">Next: System Information</TextBlock>
|
||||
|
||||
<DockPanel LastChildFill="True" Margin="5">
|
||||
<TextBlock DockPanel.Dock="Left" Margin="5" Foreground="White">Username:</TextBlock>
|
||||
<TextBox x:Name="txtusername" Margin="5" TextChanged="txtusername_TextChanged"></TextBox>
|
||||
</DockPanel>
|
||||
<DockPanel LastChildFill="True" Margin="5">
|
||||
<TextBlock DockPanel.Dock="Left" Margin="5" Foreground="White">Password:</TextBlock>
|
||||
<PasswordBox x:Name="txtpassword" Margin="5" PasswordChanged="txtpassword_PasswordChanged"></PasswordBox>
|
||||
</DockPanel>
|
||||
<DockPanel LastChildFill="True" Margin="5">
|
||||
<TextBlock DockPanel.Dock="Left" Margin="5" Foreground="White">System name:</TextBlock>
|
||||
<TextBox x:Name="txtsysname" Margin="5" TextChanged="txtsysname_TextChanged"></TextBox>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
<Button Visibility="Collapsed" Foreground="White" x:Name="nextLabel" Click="moveforward_Click">Move forward.</Button>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="TabItem" Visibility="Collapsed">
|
||||
<DockPanel Background="Black" LastChildFill="True">
|
||||
<ProgressBar x:Name="pgprogress" Background="#3FFFFFFF" Foreground="#3FFFFFFF" Value="50" Maximum="100" Height="25" DockPanel.Dock="Bottom">
|
||||
|
||||
</ProgressBar>
|
||||
<TextBox TextWrapping="Wrap" x:Name="txtterm" Background="#3FFFFFFF" Foreground="White" BorderThickness="0" IsReadOnly="True" DockPanel.Dock="Right" HorizontalAlignment="Center" VerticalAlignment="Center" Width="320" Height="200" Margin="15"></TextBox>
|
||||
<StackPanel Margin="40">
|
||||
<TextBlock Foreground="White" FontSize="20" x:Name="oobehead">Header</TextBlock>
|
||||
<TextBlock/>
|
||||
<TextBlock TextWrapping="Wrap" Foreground="White" FontSize="15" x:Name="oobedesc">This is some text.</TextBlock>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</UserControl>
|
|
@ -1,300 +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;
|
||||
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;
|
||||
using ShiftOS.Objects.ShiftFS;
|
||||
using ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for OOBE.xaml
|
||||
/// </summary>
|
||||
public partial class OOBE : UserControl, IOobe, IShiftOSWindow
|
||||
{
|
||||
public OOBE()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private Save MySave = null;
|
||||
|
||||
public void StartShowing(Save save)
|
||||
{
|
||||
MySave = save;
|
||||
AppearanceManager.SetupWindow(this);
|
||||
SetupLanguages();
|
||||
SaveSystem.GameReady += () =>
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
AppearanceManager.Close(this);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
public void SetupLanguages()
|
||||
{
|
||||
lblanguages.Items.Clear();
|
||||
|
||||
foreach(var lang in AppearanceManager.GetLanguages())
|
||||
{
|
||||
lblanguages.Items.Add(lang);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnUnload()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnUpgrade()
|
||||
{
|
||||
}
|
||||
|
||||
private void lblanguages_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
MySave.Language = lblanguages.SelectedItem.ToString();
|
||||
userInfo.Visibility = Visibility.Visible;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void txtusername_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
string usr = MySave.Username;
|
||||
|
||||
MySave.Username = txtusername.Text;
|
||||
|
||||
if(string.IsNullOrWhiteSpace(txtsysname.Text) || txtsysname.Text == usr + "-PC")
|
||||
{
|
||||
txtsysname.Text = MySave.Username + "-PC";
|
||||
}
|
||||
nextLabel.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public void moveforward_Click(object s, RoutedEventArgs a)
|
||||
{
|
||||
tabControl.SelectedItem = tabControl.Items[1];
|
||||
StartInstall();
|
||||
}
|
||||
|
||||
public void StartInstall()
|
||||
{
|
||||
Startup.ConsoleOut = txtterm;
|
||||
pgprogress.Value = 0;
|
||||
|
||||
StartOOBESlideshow();
|
||||
|
||||
}
|
||||
|
||||
public void StartOOBESlideshow()
|
||||
{
|
||||
var t = new System.Timers.Timer(10000);
|
||||
|
||||
int currentslide = 0;
|
||||
|
||||
t.Elapsed += (o, a) =>
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
switch (currentslide)
|
||||
{
|
||||
case 0:
|
||||
oobehead.Text = "Introduction";
|
||||
oobedesc.Text = @"Welcome to ShiftOS.
|
||||
|
||||
You have successfully registered to take part in the testing and development of ShiftOS. We are currently installing the system's core components.
|
||||
|
||||
This may take a while. There is a progress indicator at the bottom of this window. You can also see a log of everything that's happening in the terminal on the right.
|
||||
|
||||
While you wait, we'll take the time to tell you about what you'll be doing.";
|
||||
break;
|
||||
case 1:
|
||||
oobehead.Text = "About the project";
|
||||
oobedesc.Text = @"You may wanna know what exactly we're working on here. Basically, we want to make ShiftOS one of the most powerful, customizable, user-friendly operating systems in the world. Not just ONE of the most, we want to make it THE most.
|
||||
|
||||
We'll do whatever we can to do this - and having you onboard is just the beginning. At ShiftOS, we strive to make things user-friendly, and versatile. We want to put a barebones operating system on your computer and see what you do with it, what you make, so we can use that data to make ShiftOS awesome.";
|
||||
break;
|
||||
case 2:
|
||||
oobehead.Text = "The Humble Beginnings";
|
||||
oobedesc.Text = @"It may look complicated but we're really just wasting your time installing a blank desktop with a terminal. Seriously, that's all ShiftOS is right now. It's not about that, though.
|
||||
|
||||
It's about what you do in this blank desktop with just a terminal. We want to see what you make of it. It's a build-your-own-system type deal - one of the best in the world, in fact.";
|
||||
break;
|
||||
case 3:
|
||||
oobehead.Text = "Stay connected.";
|
||||
oobedesc.Text = @"With ShiftOS, you're always connected to something. Like literally. Even if you turn off your home router, unplug the computer or smash it you're still connected to ShiftOS's multi-user domain. There's just no escape.
|
||||
|
||||
Uhhhhhhh whoops.... I meant to make that not sound fishy.";
|
||||
|
||||
break;
|
||||
case 4:
|
||||
oobehead.Text = "Now it's too late to go back.";
|
||||
oobedesc.Text = @"I guess you weren't paying attention to that terminal seeings as you're reading this. Now, it's too late for you to go back to your old system. You're enrolled as a tester for the ShiftOS project and all your files have been deleted.
|
||||
|
||||
There's no turning back. And now that you can't leave.... I don't have to keep inticing you.";
|
||||
break;
|
||||
case 5:
|
||||
oobehead.Text = "Thanks for not choosing ShiftOS!";
|
||||
oobedesc.Text = @"By now it's definitely too late. We really value our users to the point where they can never uninstall ShiftOS. ShiftOS will haunt you in your sleep and take over your entire network. It will spread to all your friends, your family, your coworkers and even other worlds.
|
||||
|
||||
We hope you enjoy your.... eternal stay.";
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
if (currentslide == 5)
|
||||
currentslide = 0;
|
||||
else
|
||||
currentslide++;
|
||||
};
|
||||
|
||||
t.Start();
|
||||
|
||||
var th = new System.Threading.Thread(new ThreadStart(() =>
|
||||
{
|
||||
Console.WriteLine("Loading useless out-of-box-experience stuff...");
|
||||
Thread.Sleep(10000);
|
||||
Console.WriteLine("Introducing ShiftOS to the user...");
|
||||
Thread.Sleep(1000);
|
||||
Console.Write("Formatting drive 0:/ with ShiftFS 2.0...");
|
||||
Thread.Sleep(100);
|
||||
Console.WriteLine(" done");
|
||||
Thread.Sleep(500);
|
||||
Console.WriteLine("Pirating programming music...");
|
||||
Thread.Sleep(250);
|
||||
Console.Write("Deafening the user... ");
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
var th2 = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
Console.Beep(1024, 1000);
|
||||
}));
|
||||
th2.Start();
|
||||
|
||||
}
|
||||
Console.WriteLine("failed, whatever");
|
||||
|
||||
Thread.Sleep(750);
|
||||
Console.WriteLine("Writing directories to the system...");
|
||||
foreach(var path in Paths.GetAllWithoutKey())
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
if(path.StartsWith("0") && Utils.DirectoryExists(path))
|
||||
Console.WriteLine(path);
|
||||
}
|
||||
Thread.Sleep(500);
|
||||
Console.WriteLine("Procrastinating...");
|
||||
Thread.Sleep(2000);
|
||||
Console.WriteLine("Making it look like we're doing things...");
|
||||
|
||||
var rand = new Random();
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread.Sleep(1000 / i);
|
||||
Console.WriteLine(rand.Next(int.MaxValue - 1000000000, Int32.MaxValue));
|
||||
}
|
||||
catch (DivideByZeroException e)
|
||||
{
|
||||
Console.WriteLine($"Attempting to divide by zero.... but getting {e.GetType().Name}s...");
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
}
|
||||
Console.WriteLine("Still procrastinating...");
|
||||
|
||||
Thread.Sleep(5000);
|
||||
Console.Write("Enabling all the upgrades for free...");
|
||||
foreach(var upg in Shiftorium.GetDefaults())
|
||||
{
|
||||
Shiftorium.Silent = true;
|
||||
Thread.Sleep(100);
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
Shiftorium.Buy(upg.ID, 0);
|
||||
});
|
||||
}
|
||||
Shiftorium.Silent = false;
|
||||
foreach(var upg in Shiftorium.GetDefaults())
|
||||
{
|
||||
SaveSystem.CurrentSave.Upgrades[upg.ID] = false;
|
||||
}
|
||||
Console.WriteLine(" ...and disabling them because we can.");
|
||||
Dispatcher.Invoke(() => Shiftorium.InvokeUpgradeInstalled());
|
||||
|
||||
Console.WriteLine("Showing more useless stuff...");
|
||||
|
||||
while(currentslide != 0)
|
||||
{
|
||||
|
||||
}
|
||||
Console.WriteLine("Done installing.");
|
||||
|
||||
SaveSystem.CurrentSave = this.MySave;
|
||||
SaveSystem.CurrentSave.StoryPosition = 5;
|
||||
SaveSystem.SaveGame();
|
||||
}));
|
||||
th.IsBackground = true;
|
||||
th.Start();
|
||||
}
|
||||
|
||||
private void txtpassword_PasswordChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MySave.Password = txtpassword.Password;
|
||||
}
|
||||
|
||||
private void txtsysname_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
MySave.SystemName = txtsysname.Text;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,79 +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.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ShiftOS.Wpf")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ShiftOS.Wpf")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
//In order to begin building localizable applications, set
|
||||
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
|
||||
//inside a <PropertyGroup>. For example, if you are using US english
|
||||
//in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
//the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
//the line below to match the UICulture setting in the project file.
|
||||
|
||||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
[assembly: ThemeInfo(
|
||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||
//(used if a resource is not found in the page,
|
||||
// or application resource dictionaries)
|
||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||
//(used if a resource is not found in the page,
|
||||
// app, or any theme specific resource dictionaries)
|
||||
)]
|
||||
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
95
ShiftOS.Wpf/Properties/Resources.Designer.cs
generated
95
ShiftOS.Wpf/Properties/Resources.Designer.cs
generated
|
@ -1,95 +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.
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ShiftOS.Wpf.Properties
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources
|
||||
{
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((resourceMan == null))
|
||||
{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ShiftOS.Wpf.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture
|
||||
{
|
||||
get
|
||||
{
|
||||
return resourceCulture;
|
||||
}
|
||||
set
|
||||
{
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
54
ShiftOS.Wpf/Properties/Settings.Designer.cs
generated
54
ShiftOS.Wpf/Properties/Settings.Designer.cs
generated
|
@ -1,54 +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.
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ShiftOS.Wpf.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
|
@ -1,192 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A589969D-227A-48AF-A176-81022CF01E62}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ShiftOS.Wpf</RootNamespace>
|
||||
<AssemblyName>ShiftOS.Wpf</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Applications\FileDialog.xaml.cs">
|
||||
<DependentUpon>FileDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\FileSkimmer.xaml.cs">
|
||||
<DependentUpon>FileSkimmer.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\Infobox.xaml.cs">
|
||||
<DependentUpon>Infobox.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\ShiftoriumFrontend.xaml.cs">
|
||||
<DependentUpon>ShiftoriumFrontend.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\SkinLoader.xaml.cs">
|
||||
<DependentUpon>SkinLoader.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Applications\TextPad.xaml.cs">
|
||||
<DependentUpon>TextPad.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Desktop.xaml.cs">
|
||||
<DependentUpon>Desktop.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="OOBE.xaml.cs">
|
||||
<DependentUpon>OOBE.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SkinFrontend.cs" />
|
||||
<Compile Include="Startup.cs" />
|
||||
<Compile Include="WpfInfoboxFrontend.cs" />
|
||||
<Compile Include="WpfWindowBorder.xaml.cs">
|
||||
<DependentUpon>WpfWindowBorder.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="WpfWindowManager.cs" />
|
||||
<Page Include="Applications\FileDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Applications\FileSkimmer.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Applications\Infobox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Applications\ShiftoriumFrontend.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Applications\SkinLoader.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Applications\TextPad.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Desktop.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Applications\MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Applications\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="OOBE.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="WpfWindowBorder.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ShiftOS.Objects\ShiftOS.Objects.csproj">
|
||||
<Project>{A069089A-8962-4607-B2B2-4CF4A371066E}</Project>
|
||||
<Name>ShiftOS.Objects</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ShiftOS_TheReturn\ShiftOS.Engine.csproj">
|
||||
<Project>{7c979b07-0585-4033-a110-e5555b9d6651}</Project>
|
||||
<Name>ShiftOS.Engine</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -1,57 +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.Media;
|
||||
using ShiftOS.Engine;
|
||||
using static ShiftOS.Engine.SkinEngine;
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
public class SkinFrontend : FrameworkElement
|
||||
{
|
||||
public Brush GetDesktopBrush()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new ImageBrush(LoadedSkin.DesktopBackgroundImage.ToBitmapImage());
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (LoadedSkin != null)
|
||||
{
|
||||
return LoadedSkin.DesktopColor.CreateBrush();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Skin().DesktopColor.CreateBrush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,351 +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.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using ShiftOS.Engine;
|
||||
using static ShiftOS.Engine.SkinEngine;
|
||||
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
public static class ShiftOSSkin
|
||||
{
|
||||
public static Brush GetAppButtonHoverBrush(DependencyObject obj)
|
||||
{
|
||||
return (Brush)obj.GetValue(AppButtonHoverBrushProperty);
|
||||
}
|
||||
|
||||
public static void SetAppButtonHoverBrush(DependencyObject obj, Brush value)
|
||||
{
|
||||
obj.SetValue(AppButtonHoverBrushProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty AppButtonHoverBrushProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"AppButtonHoverBrush",
|
||||
typeof(Brush),
|
||||
typeof(ShiftOSSkin),
|
||||
new FrameworkPropertyMetadata(LoadedSkin.Menu_MenuItemSelected.CreateBrush()));
|
||||
}
|
||||
|
||||
public static class Startup
|
||||
{
|
||||
private static Visibility getVisibility(string upg)
|
||||
{
|
||||
if (Shiftorium.UpgradeInstalled(upg))
|
||||
{
|
||||
return Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Visibility.Collapsed;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void Upgrade(this Control ctrl, string upg)
|
||||
{
|
||||
ctrl.Visibility = getVisibility(upg);
|
||||
|
||||
}
|
||||
|
||||
public static void Upgrade(this UIElement ctrl, string upg)
|
||||
{
|
||||
ctrl.Visibility = getVisibility(upg);
|
||||
|
||||
}
|
||||
|
||||
static public void BringToFront(this UserControl pToMove, Canvas pParent)
|
||||
{
|
||||
int currentIndex = Canvas.GetZIndex(pToMove);
|
||||
int zIndex = 0;
|
||||
int maxZ = 0;
|
||||
UserControl child;
|
||||
for (int i = 0; i < pParent.Children.Count; i++)
|
||||
{
|
||||
if (pParent.Children[i] is UserControl &&
|
||||
pParent.Children[i] != pToMove)
|
||||
{
|
||||
child = pParent.Children[i] as UserControl;
|
||||
zIndex = Canvas.GetZIndex(child);
|
||||
maxZ = Math.Max(maxZ, zIndex);
|
||||
if (zIndex > currentIndex)
|
||||
{
|
||||
Canvas.SetZIndex(child, zIndex - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Canvas.SetZIndex(pToMove, maxZ);
|
||||
|
||||
}
|
||||
|
||||
public static void SetTitle(this IShiftOSWindow win, string title)
|
||||
{
|
||||
foreach(var frm in AppearanceManager.OpenForms)
|
||||
{
|
||||
if(frm.ParentWindow == win)
|
||||
{
|
||||
frm.Text = title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitiateEngine(System.IO.TextWriter writer)
|
||||
{
|
||||
OutOfBoxExperience.Init(new OOBE());
|
||||
AppearanceManager.Initiate(new WpfWindowManager());
|
||||
Infobox.Init(new WpfInfoboxFrontend());
|
||||
FileSkimmerBackend.Init(new Applications.WpfFSFrontend());
|
||||
if (writer != null)
|
||||
{
|
||||
Console.SetOut(writer);
|
||||
}
|
||||
SaveSystem.Begin(false);
|
||||
AppearanceManager.OnExit += () =>
|
||||
{
|
||||
Environment.Exit(0);
|
||||
};
|
||||
}
|
||||
|
||||
public static void SetMouseOverStyle(this Control button, string style = "")
|
||||
{
|
||||
var bg = button.Background;
|
||||
var fg = button.Foreground;
|
||||
var border = button.BorderThickness;
|
||||
var borderfg = button.BorderBrush;
|
||||
|
||||
button.MouseEnter += (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
case "menuitem":
|
||||
button.Background = LoadedSkin.Menu_MenuItemSelected.CreateBrush();
|
||||
button.Foreground = LoadedSkin.Menu_SelectedTextColor.CreateBrush();
|
||||
button.BorderBrush = LoadedSkin.Menu_MenuItemBorder.CreateBrush();
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
button.MouseLeave += (o, a) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
button.Background = bg;
|
||||
button.Foreground = fg;
|
||||
button.BorderThickness = border;
|
||||
button.BorderBrush = borderfg;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void DestroyShiftOSEngine()
|
||||
{
|
||||
ServerManager.Disconnect();
|
||||
}
|
||||
|
||||
public static TextBox ConsoleOut { get; set; }
|
||||
|
||||
public static SolidColorBrush CreateBrush(this System.Drawing.Color color)
|
||||
{
|
||||
return new SolidColorBrush(Color.FromArgb(color.A, color.R, color.G, color.B));
|
||||
}
|
||||
|
||||
public struct Font
|
||||
{
|
||||
public FontFamily FontFamily { get; set; }
|
||||
public double FontSize { get; set; }
|
||||
public FontStyle FontStyle { get; set; }
|
||||
public FontWeight FontWeight { get; set; }
|
||||
}
|
||||
|
||||
private static Font createFont(System.Drawing.Font f)
|
||||
{
|
||||
var font = new Font();
|
||||
font.FontFamily = new FontFamily(f.Name);
|
||||
font.FontSize = f.Size;
|
||||
switch (f.Style)
|
||||
{
|
||||
case System.Drawing.FontStyle.Bold:
|
||||
font.FontWeight = FontWeights.Bold;
|
||||
break;
|
||||
case System.Drawing.FontStyle.Italic:
|
||||
font.FontStyle = FontStyles.Oblique;
|
||||
break;
|
||||
default:
|
||||
case System.Drawing.FontStyle.Regular:
|
||||
font.FontStyle = FontStyles.Normal;
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
public static void SetFont(this Control ctrl, System.Drawing.Font f)
|
||||
{
|
||||
var font = createFont(f);
|
||||
ctrl.FontFamily = font.FontFamily;
|
||||
ctrl.FontSize = PointsToPixels(font.FontSize);
|
||||
ctrl.FontStyle = font.FontStyle;
|
||||
ctrl.FontWeight = font.FontWeight;
|
||||
}
|
||||
|
||||
private static double PointsToPixels(double points)
|
||||
{
|
||||
return points * (96.0 / 72.0);
|
||||
}
|
||||
|
||||
public static void SetFont(this TextBlock ui, System.Drawing.Font f)
|
||||
{
|
||||
var font = createFont(f);
|
||||
ui.FontFamily = font.FontFamily;
|
||||
ui.FontSize = PointsToPixels(font.FontSize);
|
||||
ui.FontStyle = font.FontStyle;
|
||||
ui.FontWeight = font.FontWeight;
|
||||
}
|
||||
|
||||
public static BitmapImage ToBitmapImage(this System.Drawing.Image img)
|
||||
{
|
||||
using(var str = new MemoryStream())
|
||||
{
|
||||
img.Save(str, System.Drawing.Imaging.ImageFormat.Png);
|
||||
return ToBitmapImage(str.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
public static BitmapImage ToBitmapImage(this byte[] imgSource)
|
||||
{
|
||||
using(MemoryStream ms = new MemoryStream(imgSource))
|
||||
{
|
||||
var img = new BitmapImage();
|
||||
img.BeginInit();
|
||||
img.StreamSource = ms;
|
||||
img.CacheOption = BitmapCacheOption.OnLoad;
|
||||
img.EndInit();
|
||||
return img;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class WpfTerminalTextWriter : TextWriter
|
||||
{
|
||||
public override Encoding Encoding
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.Unicode;
|
||||
}
|
||||
}
|
||||
|
||||
public TextBox UnderlyingControl
|
||||
{
|
||||
get
|
||||
{
|
||||
return Startup.ConsoleOut;
|
||||
}
|
||||
}
|
||||
|
||||
public void select()
|
||||
{
|
||||
try
|
||||
{
|
||||
UnderlyingControl.Select(UnderlyingControl.Text.Length, 0);
|
||||
UnderlyingControl.ScrollToEnd();
|
||||
UnderlyingControl.Focus();
|
||||
AppearanceManager.CurrentPosition = 1;
|
||||
AppearanceManager.LastLength = UnderlyingControl.Text.Length - 1;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public override void Write(char value)
|
||||
{
|
||||
try
|
||||
{
|
||||
UnderlyingControl.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
UnderlyingControl.AppendText(value.ToString());
|
||||
select();
|
||||
}));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public override void WriteLine(string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
UnderlyingControl.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
UnderlyingControl.AppendText(ShiftOS.Engine.Localization.Parse(value) + Environment.NewLine);
|
||||
select();
|
||||
}));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public void SetLastText()
|
||||
{
|
||||
if (SaveSystem.CurrentSave != null)
|
||||
{
|
||||
if (!Shiftorium.UpgradeInstalled("window_manager"))
|
||||
AppearanceManager.LastTerminalText = UnderlyingControl.Text;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
UnderlyingControl.Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
UnderlyingControl.AppendText(ShiftOS.Engine.Localization.Parse(value));
|
||||
select();
|
||||
}));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -1,42 +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 ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
class WpfInfoboxFrontend : IInfobox
|
||||
{
|
||||
public void Open(string title, string msg)
|
||||
{
|
||||
var inf = new Applications.Infobox(title, msg);
|
||||
AppearanceManager.SetupDialog(inf);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
<UserControl x:Class="ShiftOS.Wpf.WpfWindowBorder"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<DockPanel>
|
||||
<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 MouseLeftButtonUp="titlebar_MouseLeftButtonUp" MouseLeftButtonDown="titlebar_MouseLeftButtonDown" MouseMove="titlebar_MouseDown" x:Name="titlebar" HorizontalAlignment="Stretch" Background="Gray">
|
||||
<TextBlock MouseLeftButtonUp="titlebar_MouseLeftButtonUp" MouseLeftButtonDown="titlebar_MouseLeftButtonDown" MouseMove="titlebar_MouseDown" x:Name="titletext" VerticalAlignment="Center" Foreground="White" Height="Auto" HorizontalAlignment="Stretch" FontFamily="Tahoma" FontSize="18">This is a title.</TextBlock>
|
||||
<Button Width="24" Height="24" x:Name="close" Click="close_Click" Background="Red" Canvas.Left="266" Canvas.Top="6"/>
|
||||
<Button Width="24" Height="24" x:Name="max" Click="max_Click" Background="green" Canvas.Left="239" Canvas.Top="4" RenderTransformOrigin="0.5,0.5">
|
||||
|
||||
</Button>
|
||||
<Button Width="24" Height="24" x:Name="min" Click="min_Click" 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>
|
||||
|
||||
<UserControl.Resources>
|
||||
<!-- This style is used for buttons, to remove the WPF default 'animated' mouse over effect -->
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Name="border"
|
||||
BorderThickness="0"
|
||||
Padding="4,2"
|
||||
BorderBrush="DarkGray"
|
||||
CornerRadius="3"
|
||||
Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="BorderBrush" Value="Black" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</UserControl.Resources>
|
||||
</UserControl>
|
|
@ -1,399 +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.Forms.Integration;
|
||||
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 static ShiftOS.Engine.SkinEngine;
|
||||
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for WpfWindowBorder.xaml
|
||||
/// </summary>
|
||||
public partial class WpfWindowBorder : UserControl, IWindowBorder
|
||||
{
|
||||
private bool _isWPF = true;
|
||||
|
||||
public WpfWindowBorder(IShiftOSWindow ctrl)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (ctrl is UserControl)
|
||||
{
|
||||
_parent = ctrl as UserControl;
|
||||
_isWPF = true;
|
||||
}
|
||||
else if (ctrl is System.Windows.Forms.UserControl)
|
||||
{
|
||||
_isWPF = false;
|
||||
_wParent = ctrl as System.Windows.Forms.UserControl;
|
||||
_wParent.Show();
|
||||
}
|
||||
Shiftorium.Installed += () =>
|
||||
{
|
||||
SetupUpgradeables();
|
||||
ParentWindow.OnUpgrade();
|
||||
};
|
||||
SkinEngine.SkinLoaded += () =>
|
||||
{
|
||||
SetupSkin();
|
||||
ParentWindow.OnSkinLoad();
|
||||
};
|
||||
SaveSystem.GameReady += () =>
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
SetupUpgradeables();
|
||||
SetupSkin();
|
||||
});
|
||||
};
|
||||
if (_isWPF)
|
||||
{
|
||||
this.Width = borderleft.Width + _parent.Width + borderright.Width;
|
||||
this.Height = titlemaster.Height + _parent.Height + borderbottom.Height;
|
||||
pgcontents.Content = _parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
pgcontents.Width = _wParent.Width;
|
||||
pgcontents.Height = _wParent.Height;
|
||||
|
||||
this.Width = borderleft.Width + _wParent.Width + borderright.Width;
|
||||
this.Height = titlemaster.Height + _wParent.Height + borderbottom.Height;
|
||||
pgcontents.Content = new WindowsFormsHost();
|
||||
(pgcontents.Content as WindowsFormsHost).Child = _wParent;
|
||||
_wParent.DoWinformsSkinningMagicOnWpf();
|
||||
}
|
||||
Desktop.ShowWindow(this);
|
||||
SetupUpgradeables();
|
||||
Loaded += (o,a) =>
|
||||
{
|
||||
SetupSkin();
|
||||
ParentWindow.OnSkinLoad();
|
||||
ParentWindow.OnLoad();
|
||||
};
|
||||
|
||||
if (!_isWPF)
|
||||
{
|
||||
_wParent.TextChanged += (o, a) =>
|
||||
{
|
||||
this.Text = _wParent.Text;
|
||||
};
|
||||
this.Text = _wParent.Text;
|
||||
}
|
||||
}
|
||||
|
||||
private System.Windows.Forms.UserControl _wParent = null;
|
||||
|
||||
public void SetupUpgradeables()
|
||||
{
|
||||
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");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void SetupSkin()
|
||||
{
|
||||
if (LoadedSkin.ShowTitleCorners)
|
||||
{
|
||||
titleleft.Visibility = Visibility.Visible;
|
||||
titleright.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
titleleft.Visibility = Visibility.Hidden;
|
||||
titleright.Visibility = Visibility.Hidden;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_parent.Background = LoadedSkin.ControlColor.CreateBrush();
|
||||
_parent.Foreground = LoadedSkin.ControlTextColor.CreateBrush();
|
||||
}
|
||||
catch
|
||||
{
|
||||
_wParent.BackColor = LoadedSkin.ControlColor;
|
||||
_wParent.ForeColor = LoadedSkin.ControlTextColor;
|
||||
}
|
||||
|
||||
|
||||
titlemaster.Height = LoadedSkin.TitlebarHeight;
|
||||
if(LoadedSkin.TitleTextCentered == true)
|
||||
{
|
||||
titletext.SetValue(Canvas.LeftProperty, (double)(titlemaster.ActualWidth - titletext.ActualWidth) / 2);
|
||||
titletext.SetValue(Canvas.TopProperty, (double)LoadedSkin.TitleTextLeft.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
titletext.SetValue(Canvas.LeftProperty, (double)LoadedSkin.TitleTextLeft.X);
|
||||
titletext.SetValue(Canvas.TopProperty, (double)LoadedSkin.TitleTextLeft.Y);
|
||||
}
|
||||
|
||||
titletext.SetFont(LoadedSkin.TitleFont);
|
||||
|
||||
titletext.Foreground = LoadedSkin.TitleTextColor.CreateBrush();
|
||||
|
||||
titlebar.Background = LoadedSkin.TitleBackgroundColor.CreateBrush();
|
||||
|
||||
close.SetValue(Canvas.LeftProperty, this.ActualWidth - LoadedSkin.CloseButtonSize.Width - LoadedSkin.CloseButtonFromSide.X);
|
||||
close.SetValue(Canvas.TopProperty, (double)LoadedSkin.CloseButtonFromSide.Y);
|
||||
|
||||
min.SetValue(Canvas.LeftProperty, this.ActualWidth - LoadedSkin.MinimizeButtonSize.Width - LoadedSkin.MinimizeButtonFromSide.X);
|
||||
min.SetValue(Canvas.TopProperty, (double)LoadedSkin.MinimizeButtonFromSide.Y);
|
||||
|
||||
max.SetValue(Canvas.LeftProperty, this.ActualWidth - LoadedSkin.MaximizeButtonSize.Width - LoadedSkin.MaximizeButtonFromSide.X);
|
||||
max.SetValue(Canvas.TopProperty, (double)LoadedSkin.MaximizeButtonFromSide.Y);
|
||||
|
||||
close.Background = LoadedSkin.CloseButtonColor.CreateBrush();
|
||||
min.Background = LoadedSkin.MinimizeButtonColor.CreateBrush();
|
||||
max.Background = LoadedSkin.MaximizeButtonColor.CreateBrush();
|
||||
|
||||
close.BorderThickness = new Thickness(0.0);
|
||||
min.BorderThickness = new Thickness(0.0);
|
||||
max.BorderThickness = new Thickness(0.0);
|
||||
|
||||
borderleft.Background = LoadedSkin.BorderLeftBackground.CreateBrush();
|
||||
borderright.Background = LoadedSkin.BorderRightBackground.CreateBrush();
|
||||
borderbottom.Background = LoadedSkin.BorderBottomBackground.CreateBrush();
|
||||
borderbottoml.Background = LoadedSkin.BorderBottomLeftBackground.CreateBrush();
|
||||
borderbottomr.Background = LoadedSkin.BorderBottomRightBackground.CreateBrush();
|
||||
|
||||
borderleft.Width = LoadedSkin.LeftBorderWidth;
|
||||
borderright.Width = LoadedSkin.RightBorderWidth;
|
||||
bottommaster.Height = LoadedSkin.BottomBorderWidth;
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override Size MeasureOverride(Size constraint)
|
||||
{
|
||||
int topHeight = 0;
|
||||
int bottomHeight = 0;
|
||||
int leftHeight = 0;
|
||||
int rightHeight = 0;
|
||||
|
||||
if (Shiftorium.UpgradeInstalled("wm_titlebar"))
|
||||
topHeight = LoadedSkin.TitlebarHeight;
|
||||
if (Shiftorium.UpgradeInstalled("wm_free_placement"))
|
||||
{
|
||||
bottomHeight = LoadedSkin.BottomBorderWidth;
|
||||
leftHeight = LoadedSkin.LeftBorderWidth;
|
||||
rightHeight = LoadedSkin.RightBorderWidth;
|
||||
}
|
||||
|
||||
if (_isWPF)
|
||||
{
|
||||
return new Size(
|
||||
leftHeight + _parent.Width + rightHeight,
|
||||
topHeight + _parent.Height + bottomHeight);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Size(
|
||||
leftHeight + _wParent.Width + rightHeight,
|
||||
topHeight + _wParent.Height + bottomHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public double ActualActualHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
int topHeight = 0;
|
||||
int bottomHeight = 0;
|
||||
|
||||
if (Shiftorium.UpgradeInstalled("wm_titlebar"))
|
||||
topHeight = LoadedSkin.TitlebarHeight;
|
||||
if (Shiftorium.UpgradeInstalled("wm_free_placement"))
|
||||
{
|
||||
bottomHeight = LoadedSkin.BottomBorderWidth;
|
||||
}
|
||||
|
||||
if (_isWPF)
|
||||
{
|
||||
return (topHeight + _parent.Height + bottomHeight);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return (topHeight + _wParent.Height + bottomHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isDialog = false;
|
||||
|
||||
public bool IsDialog
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isDialog;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isDialog = value;
|
||||
SetupDialog();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetupDialog()
|
||||
{
|
||||
if (IsDialog)
|
||||
{
|
||||
min.Upgrade("minimize_button");
|
||||
max.Upgrade("maximize_button");
|
||||
}
|
||||
else
|
||||
{
|
||||
min.Visibility = Visibility.Collapsed;
|
||||
max.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
private UserControl _parent = null;
|
||||
|
||||
public IShiftOSWindow ParentWindow
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_isWPF)
|
||||
{
|
||||
return (IShiftOSWindow)_parent;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (IShiftOSWindow)_wParent;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_isWPF)
|
||||
{
|
||||
_parent = (UserControl)value;
|
||||
}
|
||||
else
|
||||
{
|
||||
_wParent = (System.Windows.Forms.UserControl)value;
|
||||
(this.pgcontents.Content as WindowsFormsHost).Child = _wParent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return titletext.Text;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
titletext.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
Desktop.RemoveWindow(this);
|
||||
}
|
||||
|
||||
private void close_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void max_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AppearanceManager.Maximize(this);
|
||||
}
|
||||
|
||||
private void min_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
AppearanceManager.Minimize(this);
|
||||
}
|
||||
|
||||
private Point currentPoint;
|
||||
private TranslateTransform transform = new TranslateTransform();
|
||||
private Point anchorPoint;
|
||||
|
||||
private void titlebar_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (Shiftorium.UpgradeInstalled("draggable_windows") && isInDrag == true)
|
||||
{
|
||||
var element = sender as FrameworkElement;
|
||||
currentPoint = e.GetPosition(null);
|
||||
|
||||
transform.X += (currentPoint.X - anchorPoint.X);
|
||||
transform.Y += (currentPoint.Y - anchorPoint.Y);
|
||||
this.RenderTransform = transform;
|
||||
anchorPoint = currentPoint;
|
||||
if(_isWPF == false)
|
||||
{
|
||||
_wParent.Refresh();
|
||||
(pgcontents.Content as WindowsFormsHost).InvalidateVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isInDrag = false;
|
||||
|
||||
private void titlebar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var element = sender as FrameworkElement;
|
||||
anchorPoint = e.GetPosition(null);
|
||||
isInDrag = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void titlebar_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
isInDrag = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 ShiftOS.Engine;
|
||||
|
||||
namespace ShiftOS.Wpf
|
||||
{
|
||||
public class WpfWindowManager : WindowManager
|
||||
{
|
||||
public override void Close(IShiftOSWindow win)
|
||||
{
|
||||
IWindowBorder brdrToClose = null;
|
||||
|
||||
foreach(WpfWindowBorder brdr in AppearanceManager.OpenForms)
|
||||
{
|
||||
if(brdr.ParentWindow == win)
|
||||
{
|
||||
brdrToClose = brdr;
|
||||
}
|
||||
}
|
||||
|
||||
if (brdrToClose != null)
|
||||
{
|
||||
brdrToClose.Close();
|
||||
AppearanceManager.OpenForms.Remove(brdrToClose);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void InvokeAction(Action act)
|
||||
{
|
||||
App.Current.Dispatcher.Invoke(act);
|
||||
}
|
||||
|
||||
public override void Maximize(IWindowBorder border)
|
||||
{
|
||||
var wb = (WpfWindowBorder)border;
|
||||
}
|
||||
|
||||
public override void Minimize(IWindowBorder border)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void SetupDialog(IShiftOSWindow win)
|
||||
{
|
||||
var brdr = new WpfWindowBorder(win);
|
||||
brdr.IsDialog = true;
|
||||
AppearanceManager.OpenForms.Add(brdr);
|
||||
}
|
||||
|
||||
public override void SetupWindow(IShiftOSWindow win)
|
||||
{
|
||||
var brdr = new WpfWindowBorder(win);
|
||||
|
||||
AppearanceManager.OpenForms.Add(brdr);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
[]
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"ConnectToMud": true,
|
||||
"MudDefaultIP": "dome.rol.im",
|
||||
"MudDefaultPort": 13370
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||
</packages>
|
Reference in a new issue