Skip to content

Commit

Permalink
Исправление ошибок модулей
Browse files Browse the repository at this point in the history
  • Loading branch information
Sereoj committed Jan 11, 2021
1 parent 9f5fba7 commit 724dd27
Show file tree
Hide file tree
Showing 13 changed files with 181 additions and 66 deletions.
6 changes: 0 additions & 6 deletions Test.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.30621.155
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{1A21368F-85AD-45C0-B61B-A90526DED6E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestConsole", "TestConsole\TestConsole.csproj", "{50E2A67E-C1CE-443D-90C9-47C48A439F00}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -17,10 +15,6 @@ Global
{1A21368F-85AD-45C0-B61B-A90526DED6E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A21368F-85AD-45C0-B61B-A90526DED6E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A21368F-85AD-45C0-B61B-A90526DED6E2}.Release|Any CPU.Build.0 = Release|Any CPU
{50E2A67E-C1CE-443D-90C9-47C48A439F00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50E2A67E-C1CE-443D-90C9-47C48A439F00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50E2A67E-C1CE-443D-90C9-47C48A439F00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50E2A67E-C1CE-443D-90C9-47C48A439F00}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
4 changes: 3 additions & 1 deletion Test/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ protected override void OnStartup(StartupEventArgs e)
base.OnStartup(e);
var args = e.Args;
SettingsModel.CreateInstance();
Theme.Set("light");

var settingsModel = SettingsModel.Instance;
Theme.Set(settingsModel.Advanced.AdvancedConfig.Theme);
}
}
}
20 changes: 2 additions & 18 deletions Test/Models/FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
using System.Linq;
using System.Threading.Tasks;
using Test.Models.Settings;
using Test.Services.Message;
using Test.ViewModels.Base;

namespace Test.Models
{
internal class FileManager : ViewModel
internal class FileManager: CLMessage
{
public enum FileMode : byte
{
Expand All @@ -20,8 +21,6 @@ public enum FileMode : byte
private static FileManager _model;


public string GetMessage { get; private set; }

public static FileManager Model => _model ??= new FileManager();

~FileManager()
Expand Down Expand Up @@ -130,7 +129,6 @@ public async Task SearchFilesAsyn(string PathNewDirectory, string PatternExtensi
SetMessage("Задача завершена!");
await Task.Delay(delay);
}

#endregion

#region Закрытые методы
Expand Down Expand Up @@ -179,20 +177,6 @@ private static IEnumerable<string> GetFilesList(string path, string formats)
.Trim()));
}

public void SetMessage(string message)
{
if (message.Length > 0)
{
GetMessage = message;
OnPropertyChanged("MessageChange");
}
else
{
GetMessage = "...";
OnPropertyChanged("MessageChange");
}
}

#endregion
}
}
1 change: 1 addition & 0 deletions Test/Models/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public enum StageVersion

public StageVersion State = StageVersion.Beta;


public static Version Model => _model ??= new Version();

/// <summary>
Expand Down
26 changes: 26 additions & 0 deletions Test/Resources/Styles/Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,32 @@
</Setter.Value>
</Setter>
</Style>
<!--Кнопки иконки SETTIGS-->
<Style x:Key="ButtonIconsSettingsInfo" TargetType="Button">
<Setter Property="FontFamily" Value="/Fonts/#IcoMoon-Free" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{DynamicResource BackLightColor}" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Height" Value="24" />
<Setter Property="Width" Value="24" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}">
<ContentPresenter Content="{TemplateBinding Content}"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource BackMediumColor}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Наследник ButtonStyle добавление иконки-->
<Style x:Key="ButtonCut" TargetType="TextBlock">
<Setter Property="Text" Value="&#xE92F;" />
Expand Down
7 changes: 7 additions & 0 deletions Test/Services/Console/Console.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Test.Services.Console
{
internal class Console
{

}
}
46 changes: 43 additions & 3 deletions Test/Services/GLUpdater/GLUpdater.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,51 @@
namespace Test.Services.GLUpdater
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
using Test.Services.Message;
using Version = Test.Models.Version;

namespace Test.Services.GLUpdater
{
/*
* Модуль обновления приложения
*
*/
internal class GLUpdater
internal class GLUpdater : CLMessage
{

private static GLUpdater _model;

public static GLUpdater Model => _model ??= new GLUpdater();

public string New_version { get; set; }


public bool IsUpdate()
{
if (Version.Model.GetVersion(false) == New_version)
{
return false;
}
return true;
}
public void Checker()
{
Task.Run(RequestAsync);
}

private async Task RequestAsync()
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://raw.githubusercontent.com/Sereoj/DesktopSort/Design/Updates/xml/update.xml");
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
using (Stream stream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream))
{
New_version = reader.ReadToEnd();
}
}
response.Close();
}
}
}
29 changes: 29 additions & 0 deletions Test/Services/Message/CLMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Test.ViewModels.Base;

namespace Test.Services.Message
{

/*
* Модуль вывода сообщений на экран
*
*/

internal class CLMessage : ViewModel
{
public string GetMessage { get; private set; }

public void SetMessage(string message)
{
if (message.Length > 0)
{
GetMessage = message;
OnPropertyChanged("MessageChange");
}
else
{
GetMessage = "...";
OnPropertyChanged("MessageChange");
}
}
}
}
12 changes: 0 additions & 12 deletions Test/Services/Message/Message.cs

This file was deleted.

9 changes: 4 additions & 5 deletions Test/Services/Theme/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ internal class Theme

private static void Changer( string theme)
{
//ResourceDictionary dictionary = new ResourceDictionary {Source = new Uri($"/Resources/Colors/{theme}.xaml", UriKind.Relative)};
//Application.Current.Resources.MergedDictionaries[0] = dictionary;

ResourceDictionary dictionary = new ResourceDictionary();
dictionary.Source = new Uri($"/Resources/Colors/{theme}.xaml", UriKind.Relative);
ResourceDictionary dictionary = new ResourceDictionary
{
Source = new Uri($"/Resources/Colors/{theme}.xaml", UriKind.Relative)
};

Application.Current.Resources.Clear();
Application.Current.Resources.MergedDictionaries.Add(dictionary);
Expand Down
3 changes: 2 additions & 1 deletion Test/Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@
<Compile Include="Models\Settings\AdvancedConfig.cs" />
<Compile Include="Models\Settings\SettingsModel.cs" />
<Compile Include="Models\Version.cs" />
<Compile Include="Services\Console\Console.cs" />
<Compile Include="Services\GLUpdater\GLUpdater.cs" />
<Compile Include="Services\Message\Message.cs" />
<Compile Include="Services\Message\CLMessage.cs" />
<Compile Include="Services\Theme\Theme.cs" />
<Compile Include="ViewModels\Base\ViewModel.cs" />
<Compile Include="ViewModels\SettingsWindowViewModel.cs" />
Expand Down
25 changes: 22 additions & 3 deletions Test/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Test.Infrastucture.Commands;
using Test.Models;
using Test.Models.Settings;
using Test.Services.GLUpdater;
using Test.Services.Theme;
using Test.ViewModels.Base;
using Test.Views.Controls;
Expand Down Expand Up @@ -67,12 +68,30 @@ private async Task Init()
// Применение title
SetTitle();
SetMessage("Добро пожаловать! Версия: " + model1.GetVersion(false));
GLUpdater.Model.Checker();


await Task.Delay(2000);

SetMessage(!model2.Advanced.AdvancedConfig.Update
? "Внимание, проверка на обновления приложения была выключена в настройках"
: "Настройки для обновления приложения были применены");
if(!model2.Advanced.AdvancedConfig.Update)
{
SetMessage("Внимание, проверка на обновления приложения была выключена в настройках");
}
else
{
SetMessage("Настройки для обновления приложения были применены");

await Task.Delay(2000);

if (GLUpdater.Model.IsUpdate())
{
SetMessage("Требуется обновление! до актуальной " + GLUpdater.Model.New_version);
}
else
{
SetMessage("Обновление не найдено!" + GLUpdater.Model.New_version);
}
}



Expand Down
59 changes: 42 additions & 17 deletions Test/Views/Controls/InfoSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,61 @@
<TextBlock Grid.Row="0" Text="О программе" FontSize="16" Margin="10,5,0,0"
Style="{DynamicResource TextBlockTitle}" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="6*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock Grid.Column="1"
Text="Desktop Sort - Это мгновенная сортировка файлов по папкам. Если придя за свое рабочее место вы обнаружите, что весь рабочий стол забит разными файлами, а ваш внутренний перфекционизм желает от этого всего избавиться, то Desktop Sort программа именно для вас!"
Foreground="White"
Margin="20,20,20,0"
FontFamily="/Test;component/Fonts/OpenSans/#Open Sans Light"
FontSize="14"
TextWrapping="Wrap"
FontWeight="Light" />
<Grid Grid.Row="1" Grid.Column="1">
<TextBlock
Text="Desktop Sort - Это мгновенная сортировка файлов по папкам. Если придя за свое рабочее место вы обнаружите, что весь рабочий стол забит разными файлами, а ваш внутренний перфекционизм желает от этого всего избавиться, то Desktop Sort программа именно для вас!"
Foreground="White"
Margin="20,20,20,40"
FontFamily="/Test;component/Fonts/OpenSans/#Open Sans Light"
FontSize="14"
TextWrapping="Wrap"
FontWeight="Light" />
<TextBlock
Text="Открытый исходный код! C# + WPF + MVVM / Дата старта 31.12.20"
Foreground="White"
Margin="20,90,0,20"
FontFamily="/Test;component/Fonts/OpenSans/#Open Sans Light"
FontSize="14"
FontWeight="Light" />
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="24" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="24" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Благодарности" FontSize="14" Margin="-5,5,0,0"
Style="{DynamicResource TextBlockTitle}" />

<TextBlock Text="Благодарности" FontSize="14" Margin="10,5,0,0"
Style="{DynamicResource TextBlockTitle}" Grid.ColumnSpan="2" />

<Button Grid.Row="1" Content="&#xEAB0;" Style="{DynamicResource ButtonIconsSettingsInfo}" Height="Auto" Margin="0.5,0" Width="Auto"
/>

<TextBlock Grid.Column="1" Grid.Row="1" Text="SergioStrangeS - Контент менеджмент"
Margin="5,5,0,0"
Foreground="White"
FontFamily="/Test;component/Fonts/OpenSans/#Open Sans Light"
FontSize="12"/>
<Button Grid.Row="2" Content="&#xEAB0;" Style="{DynamicResource ButtonIconsSettingsInfo}" Height="Auto" Margin="0.5,0" Width="Auto"
/>
<TextBlock Grid.Column="1" Grid.Row="2" Text="MerHI - Дизайн"
Margin="5,5,0,0"
Foreground="White"
FontFamily="/Test;component/Fonts/OpenSans/#Open Sans Light"
FontSize="12"/>
</Grid>
</Grid>
<Grid Grid.Row="2">
<TextBlock Text="Контакты" FontSize="16" Margin="10,5,0,70"
Style="{DynamicResource TextBlockTitle}"/>

</Grid>
</Grid>
</UserControl>

0 comments on commit 724dd27

Please sign in to comment.