source: trunk/CrypPlugins/Primes/Primes/WpfVisualization/Navigation/Navigation.xaml.cs @ 1259

Last change on this file since 1259 was 1259, checked in by wander, 4 years ago

shortened license text to boilerplate notice in all source files

File size: 5.0 KB
Line 
1/*
2   Copyright 2008 Timo Eckhardt, University of Siegen
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System;
18using System.Collections.Generic;
19using System.Text;
20using System.Windows;
21using System.Windows.Controls;
22using System.Windows.Data;
23using System.Windows.Documents;
24using System.Windows.Input;
25using System.Windows.Media;
26using System.Windows.Media.Imaging;
27using System.Windows.Navigation;
28using System.Windows.Shapes;
29using Primes.Library;
30using System.Diagnostics;
31
32namespace Primes.WpfVisualization.Navigation
33{
34 
35  /// <summary>
36  /// Interaction logic for Navigation.xaml
37  /// </summary>
38  public partial class Navigation : UserControl
39  {
40
41    public event Navigate OnNavigate;
42    public Navigation()
43    {
44      InitializeComponent();
45    }
46
47    private void UserControl_Loaded(object sender, RoutedEventArgs e)
48    {
49    }
50
51    private void expander1_Collapsed(object sender, RoutedEventArgs e)
52    {
53
54      if (sender.GetType() == typeof(Expander))
55      {
56        HandleNavigation((sender as Expander));
57      }
58
59    }
60
61    public void HandleNavigation(Expander exp)
62    {
63      //StackPanel spTarget = null;
64      //switch (exp.Name)
65      //{
66      //  case "expander1":
67      //    spTarget = stackPanel2;
68      //    break;
69      //  case "expander2":
70      //    //spTarget = stackPanel3;
71      //    break;
72      //}
73      //if (spTarget != null)
74      //{
75      //  spTarget.Visibility = (exp.IsExpanded) ? Visibility.Collapsed : Visibility.Visible;
76      //}
77    }
78
79    private void Button_Click(object sender, RoutedEventArgs e)
80    {
81      //if(OnNavigate!=null)
82      //{
83      //  NavigationCommandType commandtype = NavigationCommandType.None;
84      //  if (sender == btnFaktorisierung) commandtype = NavigationCommandType.Factor;
85      //  else if (sender == btnPrimeDistribution) commandtype = NavigationCommandType.Graph;
86      //  else if (sender == btnStartPage) commandtype = NavigationCommandType.Start;
87      //  else if (sender == btnPrimeTest) commandtype = NavigationCommandType.Primetest;
88      //  else if (sender == btnPrimeSpirals) commandtype = NavigationCommandType.Primespirals;
89      //  else if (sender == btnGeneratePrimes) commandtype = NavigationCommandType.Primesgeneration;
90      //  else if (sender == btnNumerline) commandtype = NavigationCommandType.Numberline;
91      //  else if (sender == btnPrimitiveRoot) commandtype = NavigationCommandType.PrimitivRoot;
92       
93
94      //  OnNavigate(commandtype);
95      //}
96
97    }
98
99    private void lnk_Click(object sender, RoutedEventArgs e)
100    {
101      if (OnNavigate != null)
102      {
103        NavigationCommandType commandtype = NavigationCommandType.None;
104        if (sender == lnkFacBruteForce) commandtype = NavigationCommandType.Factor_Bf;
105        //else if (sender == lnkFacQS) commandtype = NavigationCommandType.Factor_QS;
106        else if (sender == lnkTestEratothenes) commandtype = NavigationCommandType.Primetest_Sieve;
107        else if (sender == lnkTestMillerRabin) commandtype = NavigationCommandType.Primetest_Miller;
108        else if (sender == lnkDistribNumberline) commandtype = NavigationCommandType.PrimeDistrib_Numberline;
109        else if (sender == lnkDistribNumberrec) commandtype = NavigationCommandType.PrimeDistrib_Numberrec;
110        else if (sender == lnkDistribUlam) commandtype = NavigationCommandType.PrimeDistrib_Ulam;
111        else if (sender == lnkPrimitivRoots) commandtype = NavigationCommandType.PrimitivRoot;
112        else if (sender == lnkGenPrimes) commandtype = NavigationCommandType.Primesgeneration;
113        else if (sender == lnkCountPrimes) commandtype = NavigationCommandType.Graph;
114        else if (sender == lnkStartPage) commandtype = NavigationCommandType.Start;
115        else if (sender == lnkNumberTheoryFunctions) commandtype = NavigationCommandType.NumberTheoryFunctions;
116        else if (sender == lnkSieveOfAtkin) commandtype = NavigationCommandType.SieveOfAtkin;
117        else if (sender == lnkDistribGoldbach) commandtype = NavigationCommandType.PrimeDistrib_Goldbach;
118        else if (sender == lnkPowMod) commandtype = NavigationCommandType.PowerMod;
119
120
121        OnNavigate(commandtype);
122      }
123     
124    }
125
126    private void TreeViewItem_Expanded(object sender, RoutedEventArgs e)
127    {
128      if (sender.GetType() == typeof(TreeViewItem))
129      {
130        (sender as TreeViewItem).IsExpanded = true;
131      }
132    }
133
134    private void TreeViewItem_Selected(object sender, RoutedEventArgs e)
135    {
136    }
137
138
139  }
140}
Note: See TracBrowser for help on using the repository browser.