using System;
using System.Collections;
using System.Collections.Concurrent;
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 App_Project
{
/// <summary>
/// Logika interakcji dla klasy MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private IDictionary
<string, UserControl
> views
= new ConcurrentDictionary
<string, UserControl
>();
public MainWindow()
{
InitializeComponent();
MinimizeButton.Click += (s, e) => WindowState = WindowState.Minimized;
MaximizeButton.Click += (s, e) => WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
CloseButton.Click += (s, e) => Close();
StartPage();
}
private void StartPage()
{
MainGrid.Children.Add(home);
}
private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int index = ListViewMenu.SelectedIndex;
var item = ListViewMenu.Items[index] as ListViewItem;
string viewName = "Home";
if (item.Content != null)
{
viewName = (item.Content as TextBlock).Text;
}
try
{
DisplayView(viewName);
}
catch (ArgumentException ex)
{
//not recognized viewName
}
}
private void DisplayView(string viewName)
{
if (MainGrid == null)
{
return;
}
MainGrid.Children.Clear();
MainGrid.Children.Add(PickCorrectView(viewName));
}
private UserControl PickCorrectView(string viewName)
{
if (views.ContainsKey(viewName))
{
return views[viewName];
}
else
{
return AddNewView(viewName);
}
}
private UserControl AddNewView(string viewName)
{
UserControl view;
switch (viewName)
{
case "Home":
break;
case "Industry":
break;
default:
throw new ArgumentException
("can't recognize specified view name",
"viewName");
}
views.Add(viewName, view);
return view;
}
}
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}