Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<Application x:Class="UiDesignTinkering.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:UiDesignTinkering" | ||
Startup="Application_Startup"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<ResourceDictionary Source="Styles.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Windows; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
private void Application_Startup(object sender, StartupEventArgs e) | ||
{ | ||
var mainWindow = new MainWindow | ||
{ | ||
DataContext = new MainWindowViewModel() | ||
}; | ||
mainWindow.Show(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace UiDesignTinkering | ||
{ | ||
public abstract class BaseModel : IModel | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using GalaSoft.MvvmLight; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
public abstract class BaseViewModel : ViewModelBase, IViewModel | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace UiDesignTinkering | ||
{ | ||
public class Client : BaseModel | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<UserControl x:Class="UiDesignTinkering.ClientView" | ||
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:UiDesignTinkering" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid> | ||
<TextBlock>Client</TextBlock> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ClientView.xaml | ||
/// </summary> | ||
public partial class ClientView : UserControl | ||
{ | ||
public ClientView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace UiDesignTinkering | ||
{ | ||
public interface IMainViewModel : IViewModel | ||
{ | ||
bool HasFocus { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace UiDesignTinkering | ||
{ | ||
public interface IModel | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
namespace UiDesignTinkering | ||
{ | ||
public interface IViewModel | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace UiDesignTinkering | ||
{ | ||
public class InsuranceStore : Store | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<UserControl x:Class="UiDesignTinkering.InsuranceView" | ||
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:UiDesignTinkering" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid> | ||
<TextBlock>Insurance</TextBlock> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
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; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
/// <summary> | ||
/// Interaction logic for InsuranceView.xaml | ||
/// </summary> | ||
public partial class InsuranceView : UserControl | ||
{ | ||
public InsuranceView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
class InverseBoolToVisibilityConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
return new BooleanToVisibilityConverter().Convert(value, targetType, parameter, culture); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
return new BooleanToVisibilityConverter().ConvertBack(value, targetType, parameter, culture); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using GalaSoft.MvvmLight; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
public class MainViewModel<T> : BaseViewModel, IMainViewModel | ||
where T : IModel | ||
{ | ||
private bool _hasFocus; | ||
|
||
public bool HasFocus | ||
{ | ||
get => _hasFocus; | ||
set => Set(ref _hasFocus, value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace UiDesignTinkering | ||
{ | ||
public enum MainViews | ||
{ | ||
ServiceCharge, | ||
Insurance, | ||
Rent, | ||
Scheme, | ||
Client, | ||
News, | ||
Task | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<Window x:Class="UiDesignTinkering.MainWindow" | ||
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:UiDesignTinkering" | ||
mc:Ignorable="d" | ||
Title="MainWindow" Height="450" Width="800"> | ||
<Window.Resources> | ||
<local:RadioButtonCheckedConverter x:Key="RadioButtonConverter"/> | ||
<BooleanToVisibilityConverter x:Key="BoolToVisibilityConverter"/> | ||
</Window.Resources> | ||
<Grid Margin="10"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="100"/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<StackPanel Grid.Column="0"> | ||
<RadioButton GroupName="MainViews" | ||
IsChecked="{Binding MainViewSelected, Converter={StaticResource RadioButtonConverter}, ConverterParameter={x:Static local:MainViews.ServiceCharge}}"> | ||
Service Charge | ||
</RadioButton> | ||
<RadioButton GroupName="MainViews" | ||
IsChecked="{Binding MainViewSelected, Converter={StaticResource RadioButtonConverter}, ConverterParameter={x:Static local:MainViews.Insurance}}"> | ||
Insurance | ||
</RadioButton> | ||
<RadioButton GroupName="MainViews" | ||
IsChecked="{Binding MainViewSelected, Converter={StaticResource RadioButtonConverter}, ConverterParameter={x:Static local:MainViews.Rent}}"> | ||
Rent | ||
</RadioButton> | ||
<RadioButton GroupName="MainViews" | ||
IsChecked="{Binding MainViewSelected, Converter={StaticResource RadioButtonConverter}, ConverterParameter={x:Static local:MainViews.Scheme}}"> | ||
Scheme | ||
</RadioButton> | ||
<RadioButton GroupName="MainViews" | ||
IsChecked="{Binding MainViewSelected, Converter={StaticResource RadioButtonConverter}, ConverterParameter={x:Static local:MainViews.Client}}"> | ||
Client | ||
</RadioButton> | ||
<RadioButton GroupName="MainViews" | ||
IsChecked="{Binding MainViewSelected, Converter={StaticResource RadioButtonConverter}, ConverterParameter={x:Static local:MainViews.News}}"> | ||
News | ||
</RadioButton> | ||
<RadioButton GroupName="MainViews" | ||
IsChecked="{Binding MainViewSelected, Converter={StaticResource RadioButtonConverter}, ConverterParameter={x:Static local:MainViews.Task}}"> | ||
Task | ||
</RadioButton> | ||
</StackPanel> | ||
<Grid Grid.Column="1" Margin="5"> | ||
<StackPanel Visibility="{Binding ServiceChargeStoreViewModel.HasFocus, Converter={StaticResource BoolToVisibilityConverter}}"> | ||
<local:ServiceChargeView DataContext="{Binding ServiceChargeStoreViewModel}"/> | ||
</StackPanel> | ||
<StackPanel Visibility="{Binding InsuranceStoreViewModel.HasFocus, Converter={StaticResource BoolToVisibilityConverter}}"> | ||
<local:InsuranceView DataContext="{Binding InsuranceStoreViewModel}"/> | ||
</StackPanel> | ||
<StackPanel Visibility="{Binding RentStoreViewModel.HasFocus, Converter={StaticResource BoolToVisibilityConverter}}"> | ||
<local:RentView DataContext="{Binding RentStoreViewModel}"/> | ||
</StackPanel> | ||
<StackPanel Visibility="{Binding SchemeViewModel.HasFocus, Converter={StaticResource BoolToVisibilityConverter}}"> | ||
<local:SchemeView DataContext="{Binding SchemeViewModel}"/> | ||
</StackPanel> | ||
<StackPanel Visibility="{Binding ClientViewModel.HasFocus, Converter={StaticResource BoolToVisibilityConverter}}"> | ||
<local:ClientView DataContext="{Binding ClientViewModel}"/> | ||
</StackPanel> | ||
<StackPanel Visibility="{Binding NewsViewModel.HasFocus, Converter={StaticResource BoolToVisibilityConverter}}"> | ||
<local:NewsView DataContext="{Binding NewsViewModel}"/> | ||
</StackPanel> | ||
<StackPanel Visibility="{Binding TaskViewModel.HasFocus, Converter={StaticResource BoolToVisibilityConverter}}"> | ||
<local:TaskView DataContext="{Binding TaskViewModel}"/> | ||
</StackPanel> | ||
</Grid> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using GalaSoft.MvvmLight; | ||
using System.Collections.Generic; | ||
|
||
namespace UiDesignTinkering | ||
{ | ||
public class MainWindowViewModel : ViewModelBase | ||
{ | ||
private MainViews _mainViewSelected; | ||
private readonly IDictionary<int, IMainViewModel> _mainViewModels; | ||
|
||
public MainWindowViewModel() | ||
{ | ||
ServiceChargeStoreViewModel = new MainViewModel<ServiceChargeStore>(); | ||
InsuranceStoreViewModel = new MainViewModel<InsuranceStore>(); | ||
RentStoreViewModel = new MainViewModel<RentStore>(); | ||
SchemeViewModel = new MainViewModel<Scheme>(); | ||
ClientViewModel = new MainViewModel<Client>(); | ||
NewsViewModel = new MainViewModel<News>(); | ||
TaskViewModel = new MainViewModel<Task>(); | ||
_mainViewModels = new Dictionary<int, IMainViewModel> | ||
{ | ||
{ (int)MainViews.ServiceCharge, ServiceChargeStoreViewModel }, | ||
{ (int)MainViews.Insurance, InsuranceStoreViewModel }, | ||
{ (int)MainViews.Rent, RentStoreViewModel }, | ||
{ (int)MainViews.Scheme, SchemeViewModel }, | ||
{ (int)MainViews.Client, ClientViewModel }, | ||
{ (int)MainViews.News, NewsViewModel }, | ||
{ (int)MainViews.Task, TaskViewModel } | ||
}; | ||
MainViewSelected = MainViews.News; | ||
} | ||
|
||
public MainViews MainViewSelected | ||
{ | ||
get => _mainViewSelected; | ||
set | ||
{ | ||
Set(ref _mainViewSelected, value); | ||
SetFocusOnMainViewModels(); | ||
} | ||
} | ||
|
||
public IMainViewModel ServiceChargeStoreViewModel { get; } | ||
|
||
public IMainViewModel InsuranceStoreViewModel { get; } | ||
|
||
public IMainViewModel RentStoreViewModel { get; } | ||
|
||
public IMainViewModel SchemeViewModel { get; } | ||
|
||
public IMainViewModel ClientViewModel { get; } | ||
|
||
public IMainViewModel NewsViewModel { get; } | ||
|
||
public IMainViewModel TaskViewModel { get; } | ||
|
||
private void SetFocusOnMainViewModels() | ||
{ | ||
foreach (var key in _mainViewModels.Keys) | ||
{ | ||
var isSelected = key == (int)MainViewSelected; | ||
_mainViewModels[key].HasFocus = isSelected; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.