-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
170 lines (164 loc) · 8.88 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<Window x:Class="SylverInk.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SylverInk"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:ContextSettings}"
Background="{Binding MenuBackground}" Closing="MainWindow_Closing" Foreground="{Binding MenuForeground}" Height="625" Loaded="MainWindow_Loaded" MinHeight="450" MinWidth="400" MouseLeftButtonDown="Drag" ResizeMode="NoResize" SizeChanged="MainWindow_SizeChanged" Title="Sylver Ink" Width="450">
<Window.Resources>
<ResourceDictionary>
<DataTemplate x:Key="DatabaseContentTemplate">
<TabControl Background="{Binding MenuBackground}" Foreground="{Binding MenuForeground}" Grid.Row="1" Margin="-3,0" SelectedIndex="0" SelectionChanged="TabChanged" x:Name="NotesPanel">
<TabItem>
<TabItem.Header>
<Grid>
<Label Content="+"/>
</Grid>
</TabItem.Header>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Content="Recent notes" FontStyle="Italic" HorizontalAlignment="Right" VerticalAlignment="Bottom"/>
<Border Grid.Row="1" BorderBrush="{Binding AccentBackground}" BorderThickness="1">
<Grid Background="{Binding AccentBackground}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListBox AlternationCount="2" BorderThickness="0" HorizontalContentAlignment="Right" ItemsSource="{Binding RecentNotes}" Margin="0,0,1,0" MinWidth="60" MouseDoubleClick="SublistOpen" SelectionChanged="SublistChanged"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" x:Name="ShortChanges">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock HorizontalAlignment="Right" Text="{Binding Path=ShortChange}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<ListBox AlternationCount="2" BorderThickness="0" Grid.Column="1" ItemsSource="{Binding RecentNotes}" Margin="1,0,0,0" MouseDoubleClick="SublistOpen" SelectionChanged="SublistChanged"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" x:Name="RecentNotes">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Preview}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Border>
</Grid>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Bottom">
<Label Content="New note" FontStyle="Italic"/>
<Label Content="(?)" Foreground="{Binding AccentForeground}" ToolTip="Write a line of text and press Enter to create a new note. You can also use the Ctrl+N hotkey to open a sticky note at any time."/>
</StackPanel>
<TextBox KeyDown="NewNote_Keydown" Margin="5" Grid.Row="2" VerticalAlignment="Top"/>
<Grid Margin="0,10" Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Click="Button_Click" Grid.Column="1" Content="Search"/>
<Button Click="Button_Click" Grid.Column="3" Content="Replace" Grid.Row="2" x:Name="ReplaceButton"/>
<Button Click="Button_Click" Grid.Column="3" Content="Import"/>
<Button Click="Button_Click" Grid.Column="1" Content="Settings" Grid.Row="2"/>
<Button Background="{Binding AccentBackground}" Click="Button_Click" Grid.Column="2" Content="Exit" Foreground="{Binding AccentForeground}" Grid.Row="1"/>
</Grid>
</Grid>
</TabItem>
</TabControl>
</DataTemplate>
</ResourceDictionary>
</Window.Resources>
<Grid Background="{Binding AccentBackground}" x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Popup Closed="RenameClosed" Height="75" IsOpen="False" KeyDown="RenameKeyDown" Placement="Mouse" PopupAnimation="Fade" StaysOpen="False" Width="275" x:Name="RenameDatabase">
<Border BorderBrush="{Binding MenuForeground}" BorderThickness="1">
<Grid Background="{Binding MenuBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBox Width="250" Margin="0,10" x:Name="DatabaseNameBox"/>
<Button Click="SaveNewName" Content="Save" Margin="0,5" Grid.Row="1"/>
</Grid>
</Border>
</Popup>
<Popup Height="75" IsOpen="False" KeyDown="AddressKeyDown" Placement="Mouse" PopupAnimation="Fade" StaysOpen="False" Width="275" x:Name="ConnectAddress">
<Border BorderBrush="{Binding MenuForeground}" BorderThickness="1">
<Grid Background="{Binding MenuBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Center">
<Label Content="Address Code:"/>
<TextBox Width="75" Margin="0,10" x:Name="AddressBox"/>
<Label Content="(?)" Foreground="{Binding AccentForeground}" ToolTip="Enter a code generated by the Sylver Ink server."/>
</StackPanel>
<Button Click="SaveAddress" Content="Connect" Margin="0,5" Grid.Row="1"/>
</Grid>
</Border>
</Popup>
<Popup Closed="CodePopupClosed" Height="75" IsOpen="False" Placement="Mouse" PopupAnimation="Fade" StaysOpen="False" Width="275" x:Name="CodePopup">
<Border BorderBrush="{Binding MenuForeground}" BorderThickness="1">
<Grid Background="{Binding MenuBackground}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" VerticalAlignment="Center">
<Label Content="Address Code:"/>
<TextBox Margin="0,10" IsReadOnly="True" Width="75" x:Name="CodeBox"/>
<Label Content="(?)" Foreground="{Binding AccentForeground}" ToolTip="Enter this code in another Sylver Ink installation to connect to the database."/>
</StackPanel>
<Button Click="CopyCode" Content="Copy" Margin="0,5" Grid.Row="1"/>
</Grid>
</Border>
</Popup>
<Menu Background="{Binding MenuBackground}" x:Name="DatabaseContextMenu">
<MenuItem Header="File" Height="25">
<MenuItem Click="DatabaseCreate" Header="New" Tag="Always"/>
<MenuItem Click="DatabaseOpen" Header="Open..." Tag="Always"/>
<MenuItem Click="DatabaseSaveAs" Header="Save as..." Tag="Always"/>
<MenuItem Click="DatabaseSaveLocal" Header="Save to Documents" Tag="Always"/>
<MenuItem Click="DatabaseDelete" Header="Delete" IsEnabled="False"/>
</MenuItem>
<MenuItem Header="Database" Height="25">
<MenuItem Click="DatabaseClose" Header="Close" IsEnabled="False"/>
<MenuItem Click="DatabaseBackup" Header="Backup..." Tag="Always"/>
<MenuItem Click="DatabaseRename" Header="Rename" Tag="Always"/>
<MenuItem Click="DatabaseProperties" Header="Properties" Tag="Always"/>
</MenuItem>
<MenuItem Header="Network" Height="25">
<MenuItem Click="DatabaseUnserve" Header="Close to Network" IsEnabled="False" Tag="Serving"/>
<MenuItem Click="DatabaseConnect" Header="Connect" Tag="NotConnected"/>
<MenuItem Click="DatabaseDisconnect" Header="Disconnect" IsEnabled="False" Tag="Connected"/>
<MenuItem Click="DatabaseServe" Header="Open to Network" Tag="NotServing"/>
</MenuItem>
</Menu>
<Label Content="Sylver Ink" FontSize="16" FontStyle="Italic" FontWeight="Light" Grid.Row="1" HorizontalAlignment="Center" Margin="0,15" VerticalAlignment="Top"/>
<TabControl Background="{Binding MenuBackground}" Foreground="{Binding MenuForeground}" Grid.Row="2" SelectionChanged="TabChanged" x:Name="DatabasesPanel"/>
<Label Content="{Binding VersionString}" FontSize="9" FontStyle="Italic" FontWeight="Light" HorizontalAlignment="Right" Margin="0,5" Grid.Row="3" VerticalAlignment="Bottom"/>
</Grid>
</Window>