Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/breslavsky/queue
Browse files Browse the repository at this point in the history
  • Loading branch information
breslavsky committed Mar 3, 2016
2 parents b085a8e + 425dc28 commit d0c505e
Show file tree
Hide file tree
Showing 25 changed files with 512 additions and 117 deletions.
9 changes: 8 additions & 1 deletion sources/Display/AppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Queue.Display.Models
{
public class AppSettings : ConfigurationSection
{
public const string SectionKey = "displaySettings";
public const string SectionKey = "display";

public AppSettings()
{
Expand Down Expand Up @@ -36,6 +36,13 @@ public Language Language
set { this["language"] = value; }
}

[ConfigurationProperty("screenNumber")]
public byte ScreenNumber
{
get { return (byte)this["screenNumber"]; }
set { this["screenNumber"] = value; }
}

[ConfigurationProperty("endpoint")]
public string Endpoint
{
Expand Down
14 changes: 14 additions & 0 deletions sources/Display/ViewModels/LoginPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
using Queue.Services.Contracts.Server;
using Queue.Services.DTO;
using Queue.UI.WPF;
using Queue.UI.WPF.Types;
using System;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using WPFLocalizeExtension.Engine;
using WinForms = System.Windows.Forms;

namespace Queue.Display.ViewModels
{
public class LoginPageViewModel : RichViewModel, IDisposable
{
private bool disposed;
private AccentColorComboBoxItem selectedAccent;
private ScreenNumberItem selectedScreenNumber;
private bool isConnected;

private string endpoint;
Expand Down Expand Up @@ -66,6 +69,14 @@ public Guid SelectedWorkplace
set { SetProperty(ref selectedWorkplace, value); }
}

public ScreenNumberItem[] ScreensNumbers { get; set; }

public ScreenNumberItem SelectedScreenNumber
{
get { return selectedScreenNumber; }
set { SetProperty(ref selectedScreenNumber, value); }
}

public AccentColorComboBoxItem[] AccentColors { get; set; }

public AccentColorComboBoxItem SelectedAccent
Expand Down Expand Up @@ -121,6 +132,7 @@ public LoginPageViewModel(RichPage owner)
this.owner = owner;

AccentColors = ThemeManager.Accents.Select(a => new AccentColorComboBoxItem(a.Name, a.Resources["AccentColorBrush"] as Brush)).ToArray();
ScreensNumbers = WinForms.Screen.AllScreens.Select((s, pos) => new ScreenNumberItem((byte)pos)).ToArray();

LoadedCommand = new RelayCommand(Loaded);
UnloadedCommand = new RelayCommand(Unloaded);
Expand All @@ -144,6 +156,7 @@ private void LoadSettings()
SelectedWorkplace = AppSettings.WorkplaceId;
SelectedLanguage = AppSettings.Language;
IsRemember = AppSettings.IsRemember;
SelectedScreenNumber = ScreensNumbers.FirstOrDefault(d => d.Number == AppSettings.ScreenNumber);

if (!String.IsNullOrWhiteSpace(AppSettings.Accent))
{
Expand Down Expand Up @@ -223,6 +236,7 @@ private void SaveSettings()
AppSettings.IsRemember = IsRemember;
AppSettings.Accent = SelectedAccent == null ? String.Empty : SelectedAccent.Name;
AppSettings.Language = SelectedLanguage;
AppSettings.ScreenNumber = SelectedScreenNumber == null ? (byte)0 : SelectedScreenNumber.Number;

ConfigurationManager.Save();
}
Expand Down
6 changes: 3 additions & 3 deletions sources/Display/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
using Queue.UI.WPF;
using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Input;
using WPFLocalizeExtension.Engine;
using WinForms = System.Windows.Forms;

namespace Queue.Display.ViewModels
{
Expand Down Expand Up @@ -86,9 +86,9 @@ private void OnLogined(object sender, EventArgs e)

Application.Current.MainWindow.KeyDown += OnKeyDown;

var screen = System.Windows.Forms.Screen.AllScreens.FirstOrDefault(s => !s.Primary);
if (screen != null)
if (AppSettings.ScreenNumber < WinForms.Screen.AllScreens.Length)
{
var screen = WinForms.Screen.AllScreens[AppSettings.ScreenNumber];
Application.Current.MainWindow.Left = screen.WorkingArea.Left;
Application.Current.MainWindow.Top = screen.WorkingArea.Top;
}
Expand Down
15 changes: 12 additions & 3 deletions sources/Display/Views/LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</i:Interaction.Triggers>

<Border>
<Grid Width="400" Height="220">
<Grid Width="400" Height="250">
<Border BorderBrush="{DynamicResource AccentColorBrush}"
BorderThickness="2"
CornerRadius="5"
Expand All @@ -34,6 +34,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Column="0" Content="{lex:Loc Server}" />
<Grid Grid.Column="2" Margin="5">
Expand Down Expand Up @@ -91,8 +92,8 @@
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Label Grid.Row="3" Content="{lex:Loc Language}" />

<Label Grid.Row="3" Content="{lex:Loc Language}" />
<lex:EnumComboBox Grid.Row="3"
Grid.Column="1"
Margin="5"
Expand Down Expand Up @@ -123,7 +124,15 @@
</Style>
</lex:EnumComboBox.Style>
</lex:EnumComboBox>
<Grid Grid.Row="4"
<Label Grid.Row="4" Content="{lex:Loc ScreenNumber}" />
<ComboBox Grid.Row="4"
Grid.Column="1"
Margin="5"
ItemsSource="{Binding ScreensNumbers,
Mode=OneWay}"
SelectedItem="{Binding SelectedScreenNumber,
Mode=TwoWay}" />
<Grid Grid.Row="5"
Grid.Column="2"
Margin="5">
<Grid.ColumnDefinitions>
Expand Down
4 changes: 2 additions & 2 deletions sources/Notification/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public partial class App : RichApplication
protected override void RegistrateTypes(IUnityContainer container)
{
container.RegisterInstance(new ConfigurationManager(Product.Notification.AppName, SpecialFolder.ApplicationData));
container.RegisterType<NotificationSettings>(new InjectionFactory(c => c.Resolve<ConfigurationManager>()
.GetSection<NotificationSettings>(NotificationSettings.SectionKey)));
container.RegisterType<AppSettings>(new InjectionFactory(c => c.Resolve<ConfigurationManager>()
.GetSection<AppSettings>(AppSettings.SectionKey)));
container.RegisterType<HubSettings>(new InjectionFactory(c => c.Resolve<ConfigurationManager>()
.GetSection<HubSettings>(HubSettings.SectionKey)));
}
Expand Down
2 changes: 1 addition & 1 deletion sources/Notification/Notification.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Settings\NotificationSettings.cs" />
<Compile Include="Settings\AppSettings.cs" />
<Compile Include="Settings\DisplayCollection.cs" />
<Compile Include="Settings\DisplayConfig.cs" />
<Compile Include="Settings\WorkplaceConfig.cs" />
Expand Down
11 changes: 10 additions & 1 deletion sources/Notification/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions sources/Notification/Resources/Strings.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<data name="Client" xml:space="preserve">
<value>Client</value>
</data>
<data name="IsFullScreen" xml:space="preserve">
<value>Full Screen</value>
</data>
<data name="Workplace" xml:space="preserve">
<value>Workplace</value>
</data>
Expand Down
3 changes: 3 additions & 0 deletions sources/Notification/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
<data name="Client" xml:space="preserve">
<value>Посетитель</value>
</data>
<data name="IsFullScreen" xml:space="preserve">
<value>Во весь экран</value>
</data>
<data name="Workplace" xml:space="preserve">
<value>Окно</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,78 @@
using Queue.Common;
using System.Configuration;

namespace Queue.Notification.Settings
{
public class NotificationSettings : ConfigurationSection
{
public const string SectionKey = "notification";

public NotificationSettings()
{
Theme = "default";
Endpoint = "net.tcp://queue:4505";
IsFullScreen = true;
}

[ConfigurationProperty("endpoint")]
public string Endpoint
{
get { return (string)this["endpoint"]; }
set { this["endpoint"] = value; }
}

[ConfigurationProperty("theme")]
public string Theme
{
get { return (string)this["theme"]; }
set { this["theme"] = value; }
}

[ConfigurationProperty("isRemember")]
public bool IsRemember
{
get { return (bool)this["isRemember"]; }
set { this["isRemember"] = value; }
}

[ConfigurationProperty("isFullScreen", DefaultValue = true)]
public bool IsFullScreen
{
get { return (bool)this["isFullScreen"]; }
set { this["isFullScreen"] = value; }
}

[ConfigurationProperty("language")]
public Language Language
{
get { return (Language)this["language"]; }
set { this["language"] = value; }
}

[ConfigurationProperty("accent")]
public string Accent
{
get { return (string)this["accent"]; }
set { this["accent"] = value; }
}

[ConfigurationProperty("displays")]
[ConfigurationCollection(typeof(DisplayCollection))]
public DisplayCollection Displays
{
get { return (DisplayCollection)base["displays"]; }
}

public override bool IsReadOnly()
{
return false;
}
}
using Queue.Common;
using System.Configuration;

namespace Queue.Notification.Settings
{
public class AppSettings : ConfigurationSection
{
public const string SectionKey = "notification";

public AppSettings()
{
Theme = "default";
Endpoint = "net.tcp://queue:4505";
IsFullScreen = true;
}

[ConfigurationProperty("endpoint")]
public string Endpoint
{
get { return (string)this["endpoint"]; }
set { this["endpoint"] = value; }
}

[ConfigurationProperty("theme")]
public string Theme
{
get { return (string)this["theme"]; }
set { this["theme"] = value; }
}

[ConfigurationProperty("isRemember")]
public bool IsRemember
{
get { return (bool)this["isRemember"]; }
set { this["isRemember"] = value; }
}

[ConfigurationProperty("isFullScreen", DefaultValue = true)]
public bool IsFullScreen
{
get { return (bool)this["isFullScreen"]; }
set { this["isFullScreen"] = value; }
}

[ConfigurationProperty("screenNumber")]
public byte ScreenNumber
{
get { return (byte)this["screenNumber"]; }
set { this["screenNumber"] = value; }
}

[ConfigurationProperty("language")]
public Language Language
{
get { return (Language)this["language"]; }
set { this["language"] = value; }
}

[ConfigurationProperty("accent")]
public string Accent
{
get { return (string)this["accent"]; }
set { this["accent"] = value; }
}

[ConfigurationProperty("displays")]
[ConfigurationCollection(typeof(DisplayCollection))]
public DisplayCollection Displays
{
get { return (DisplayCollection)base["displays"]; }
}

public override bool IsReadOnly()
{
return false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class ClientRequestsControlViewModel : RichViewModel, IDisposable
public TaskPool TaskPool { get; set; }

[Dependency]
public NotificationSettings AppSettings { get; set; }
public AppSettings AppSettings { get; set; }

[Dependency]
public HubSettings HubSettings { get; set; }
Expand Down
Loading

0 comments on commit d0c505e

Please sign in to comment.