Skip to content

Commit 8418cfd

Browse files
authored
new style (#11)
closes #1
1 parent 7b1b365 commit 8418cfd

16 files changed

+417
-63
lines changed

PrinterApp/App.xaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:local="clr-namespace:PrinterApp"
5-
StartupUri="MainWindow.xaml">
5+
Startup="App_OnStartup" >
66
<Application.Resources>
7-
<SolidColorBrush x:Key="Brush1" Color="#FF4086C2" />
8-
<SolidColorBrush x:Key="Brush2" Color="#FFC5DBED" />
9-
<SolidColorBrush x:Key="Brush3" Color="#FF2E6592" />
10-
<ImageBrush x:Key="BrushBg" ImageSource="Images/bg.png" />
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<ResourceDictionary Source="Styles.xaml" />
10+
</ResourceDictionary.MergedDictionaries>
11+
</ResourceDictionary>
1112
</Application.Resources>
1213
</Application>

PrinterApp/App.xaml.cs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Configuration;
4-
using System.Data;
5-
using System.Linq;
6-
using System.Threading.Tasks;
1+
using Serilog;
2+
using System.Reflection;
73
using System.Windows;
84

95
namespace PrinterApp
@@ -13,5 +9,19 @@ namespace PrinterApp
139
/// </summary>
1410
public partial class App : Application
1511
{
12+
private void App_OnStartup(object sender, StartupEventArgs e)
13+
{
14+
var fileName = GetType().Namespace;
15+
Log.Logger = new LoggerConfiguration().MinimumLevel.Information()
16+
.WriteTo.Console()
17+
.WriteTo.File($"logs/{fileName}.txt", rollingInterval: RollingInterval.Day)
18+
.CreateLogger();
19+
20+
//Since we no longer have the StarupUri, we have to manually open our window.
21+
MainWindow = new MainWindow();
22+
var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
23+
MainWindow.Title = $"{MainWindow.Title} {assemblyVersion}";
24+
MainWindow.Show();
25+
}
1626
}
1727
}

PrinterApp/Fonts/PTSans-Regular.ttf

Lines changed: 0 additions & 3 deletions
This file was deleted.

PrinterApp/Fonts/Roboto-Bold.ttf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:ec685a46105296fe46c8744da4a11cf8118ba6c11271941766f7a546df6aa7c7
3+
size 167336
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:4e147ab64b9fdf6d89d01f6b8c3ca0b3cddc59d608a8e2218f9a2504b5c98e14
3+
size 168260
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

PrinterApp/Images/bg.png

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Loading

PrinterApp/MainWindow.xaml

Lines changed: 98 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,104 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:local="clr-namespace:PrinterApp"
77
mc:Ignorable="d"
8-
Title="MainWindow" Height="125" Width="250" WindowStyle="None" ResizeMode="NoResize" Topmost="True"
9-
Closed="MainWindow_OnClosed" ShowInTaskbar="False"
10-
FontFamily="/PrinterApp;component/Fonts/#PT Sans"
8+
Title="PrintApp" Height="900" Width="1600"
9+
Closed="MainWindow_OnClosed"
10+
FontFamily="/PrinterApp;component/Fonts/#Roboto"
11+
WindowState="Maximized"
12+
WindowStyle="None"
13+
ResizeMode="NoResize"
14+
Topmost="True"
15+
ShowInTaskbar="False"
1116
d:DataContext="{d:DesignInstance local:PrinterViewModel}">
12-
<Viewbox>
13-
<Grid Background="{StaticResource BrushBg}" Height="200" Width="400">
14-
<Grid.RowDefinitions>
15-
<RowDefinition />
16-
<RowDefinition />
17-
</Grid.RowDefinitions>
18-
<TextBox x:Name="Code" Grid.Row="0" Margin="20" PreviewTextInput="TextBox_OnPreviewTextInput"
19-
DataObject.Pasting="TextBoxPasting" PreviewKeyDown="TextBox_OnKeyDown" IsUndoEnabled="False"
20-
FontSize="26" Text="{Binding CodeTextBoxText, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding TextBlockEnabled}"
21-
TextAlignment="Center" Padding="10" Background="{StaticResource Brush2}" />
22-
<StackPanel Grid.Row="1" Margin="30" Orientation="Horizontal" HorizontalAlignment="Center">
23-
<Button x:Name="Print1" Content="Печать" Click="Print_OnClick" Width="150"
24-
HorizontalContentAlignment="Center" Background="{StaticResource Brush2}" FontSize="17"
25-
IsDefault="True" IsEnabled="{Binding TextBlockEnabled}" />
26-
<Button x:Name="Print2" Content="Печать с диалогом" Click="Print_OnClick" Width="150"
27-
HorizontalContentAlignment="Center" Background="{StaticResource Brush2}" FontSize="17"
28-
Margin="5,0,0,0" IsEnabled="{Binding TextBlockEnabled}" />
29-
</StackPanel>
30-
<TextBlock x:Name="ErrorBlock" Grid.Row="1" Margin="30 0 30 70" FontSize="24" FontFamily="Source Sans Pro"
31-
TextAlignment="Center" Foreground="DarkRed" Text="{Binding ErrorTextBlockText}" />
32-
<ProgressBar x:Name="ProgressBar" Grid.Row="1" Margin="30"
33-
Visibility="{Binding ProgressBarVisibility}" Value="{Binding ProgressBarValue}" />
34-
</Grid>
17+
<Viewbox Stretch="Fill">
18+
<Canvas Background="{DynamicResource App.Background}" Height="900" Width="1600">
19+
<Rectangle Width="3" Height="590" Canvas.Left="684" Canvas.Top="155"
20+
Fill="{DynamicResource Labels.Foreground}" />
21+
<TextBlock FontSize="24" Width="641" Height="449" Canvas.Left="814" Canvas.Top="57" TextWrapping="Wrap"
22+
Foreground="{DynamicResource Labels.Foreground}" FontFamily="Roboto" FontWeight="Bold">
23+
<Run
24+
Text="0) Подключись со своего устройства к интернету. Можно воспользоваться сетями Wi-Fi в холле ЦФА или гостевым Wi-Fi PKFF_Free. " />
25+
<LineBreak />
26+
<Run
27+
Text="1) Перейди по ссылке и авторизуйся по фамилии и номеру профсоюзго билета (смотри карту Zachet или в личном кабинете https://lk.msuprof.com/login) " />
28+
<LineBreak /><Run Text="2) Выбери и прикрепи файл. " /><LineBreak />
29+
<Run Text="3) Получи комбинацию цифр для печати документа. " /><LineBreak />
30+
<Run Text="4) Введи комбинацию в окно ввода на компьютере бесплатного принтера" />
31+
</TextBlock>
32+
<TextBlock Text="Приложение Твой ФФ!" FontSize="24" Width="256" Height="28" Canvas.Left="854"
33+
Canvas.Top="540" TextWrapping="Wrap" Foreground="{DynamicResource Labels.Foreground}"
34+
FontWeight="Bold" />
35+
<TextBlock Text="Бот принтера ВК" FontSize="24" Width="189" Height="28" Canvas.Left="1208" Canvas.Top="540"
36+
TextWrapping="Wrap" Foreground="{DynamicResource Labels.Foreground}" FontWeight="Bold" />
37+
<TextBlock Text="app.profcomff.com" FontSize="24" Width="209" Height="28" Canvas.Left="878"
38+
Canvas.Top="815" TextWrapping="Wrap" Foreground="{DynamicResource Labels.Foreground}"
39+
FontWeight="Bold" />
40+
<TextBlock Text="vk.me/profcomff_print" FontSize="24" Width="244" Height="28" Canvas.Left="1181"
41+
Canvas.Top="815" TextWrapping="Wrap" Foreground="{DynamicResource Labels.Foreground}"
42+
FontWeight="Bold" />
43+
<Rectangle Width="212" Height="212" Fill="{DynamicResource Qr.AppProfcomffCom}" Canvas.Left="876"
44+
Canvas.Top="591" HorizontalAlignment="Center" VerticalAlignment="Top" />
45+
<Rectangle Width="212" Height="212" Fill="{DynamicResource Qr.ProfcomffPrint}" Canvas.Left="1197"
46+
Canvas.Top="591" HorizontalAlignment="Left" VerticalAlignment="Center" />
47+
<Grid Height="289" Canvas.Left="82" Canvas.Top="301" Width="410">
48+
<TextBlock Text="Код документа для печати" FontSize="24" TextWrapping="Wrap"
49+
Foreground="{DynamicResource Labels.Foreground}" FontWeight="Bold" Margin="0,0,104,261" />
50+
<TextBox PreviewTextInput="TextBox_OnPreviewTextInput" BorderBrush="Red" BorderThickness="0"
51+
DataObject.Pasting="TextBoxPasting" PreviewKeyDown="TextBox_OnKeyDown" IsUndoEnabled="False"
52+
FontSize="24"
53+
Text="{Binding CodeTextBoxText, FallbackValue=123, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
54+
IsEnabled="{Binding DownloadNotInProgress}"
55+
TextAlignment="Center" Background="{DynamicResource TextBox.Background}"
56+
Foreground="{DynamicResource TextBox.Foreground}" VerticalContentAlignment="Center"
57+
HorizontalContentAlignment="Center" Margin="0,29,0,208" />
58+
<Label FontSize="16" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
59+
Background="Red" Foreground="White" Content="{Binding ErrorTextBlockText, FallbackValue=123}"
60+
Padding="0,0,0,0" Margin="0,97,0,162" Visibility="{Binding ErrorTextBlockVisibility}" />
61+
<Button Content="Распечатать сразу" Click="Print_OnClick"
62+
Style="{DynamicResource MyButtonStyle}" FontSize="20"
63+
IsEnabled="{Binding DownloadNotInProgress}" Margin="0,161,0,76" />
64+
<Button Content="Изменить настройки и распечатать" Click="Print_OnClick"
65+
Style="{DynamicResource MyButtonStyle}" FontSize="20"
66+
IsEnabled="False" Margin="0,237,0,0" Visibility="Collapsed" />
67+
<ProgressBar Visibility="{Binding ProgressBarVisibility}"
68+
Value="{Binding ProgressBarValue, FallbackValue=20}" Background="#FFD9D9D9"
69+
Foreground="#FF8B00" Margin="0,97,0,162" />
70+
</Grid>
71+
<Grid Height="374" Canvas.Left="82" Canvas.Top="273" Width="410" Visibility="Collapsed" d:IsHidden="True">
72+
<TextBlock Text="Страницы" FontSize="24" TextWrapping="Wrap"
73+
Foreground="{DynamicResource Labels.Foreground}" FontWeight="Bold" Margin="0,0,292,346" />
74+
<TextBox Style="{DynamicResource MyTextBoxStyle}" PreviewTextInput="TextBox_OnPreviewTextInput"
75+
BorderBrush="Red" BorderThickness="4"
76+
DataObject.Pasting="TextBoxPasting" PreviewKeyDown="TextBox_OnKeyDown" IsUndoEnabled="False"
77+
FontSize="24"
78+
Text="{Binding CodeTextBoxText, FallbackValue=123, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
79+
IsEnabled="{Binding DownloadNotInProgress}"
80+
TextAlignment="Left" Background="{DynamicResource TextBox.Background}"
81+
Foreground="{DynamicResource TextBox.Foreground}" VerticalContentAlignment="Center"
82+
Margin="0,30,0,292" />
83+
<TextBlock Text="Количество копий" FontSize="24" TextWrapping="Wrap"
84+
Foreground="{DynamicResource Labels.Foreground}" FontWeight="Bold" Margin="0,106,202,240" />
85+
<TextBox PreviewTextInput="TextBox_OnPreviewTextInput" BorderBrush="Red" BorderThickness="4"
86+
DataObject.Pasting="TextBoxPasting" PreviewKeyDown="TextBox_OnKeyDown" IsUndoEnabled="False"
87+
FontSize="24"
88+
Text="{Binding CodeTextBoxText, FallbackValue=123, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
89+
IsEnabled="{Binding DownloadNotInProgress}"
90+
TextAlignment="Left" Background="{DynamicResource TextBox.Background}"
91+
Foreground="{DynamicResource TextBox.Foreground}" VerticalContentAlignment="Center"
92+
HorizontalContentAlignment="Left" Margin="0,134,0,188" />
93+
<CheckBox Style="{DynamicResource MyCheckBoxStyle}" FontSize="24" FontWeight="Bold"
94+
Content="Печатать с обеих сторон листа" Foreground="White" Padding="0,0,0,0"
95+
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
96+
UseLayoutRounding="True" IsChecked="True" Margin="0,210,0,132" />
97+
<Label FontSize="16" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
98+
Background="Red" Foreground="White" Content="{Binding ErrorTextBlockText, FallbackValue=123}"
99+
Padding="0,0,0,0" Margin="0,259,0,85" />
100+
<ProgressBar Value="{Binding ProgressBarValue, FallbackValue=20}" Background="#FFD9D9D9"
101+
Foreground="#FF8B00" Margin="0,259,0,85" />
102+
<Button Style="{DynamicResource MyButtonStyle}" Content="Распечатать" Click="ManualPrint_OnClick"
103+
Foreground="{DynamicResource Button.Foreground}" FontSize="20"
104+
IsDefault="True" IsEnabled="{Binding DownloadNotInProgress}" Margin="0,322,0,0" />
105+
</Grid>
106+
</Canvas>
35107
</Viewbox>
36108
</Window>

0 commit comments

Comments
 (0)