SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Menu.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9 using System.Windows;
10 
11 namespace SeciControls
12 {
13  public partial class Menu : UserControl
14  {
15  public event RoutedEventHandler OnNewClicked;
16  public event RoutedEventHandler OnOpenClicked;
17  public event RoutedEventHandler OnSaveClicked;
18  public event RoutedEventHandler OnSaveAsClicked;
19  public event RoutedEventHandler OnExitClicked;
20  public event RoutedEventHandler OnLoginClicked;
21  public event RoutedEventHandler OnLogoutClicked;
22 
23  public event RoutedEventHandler OnRecentConfigClicked;
24 
25  public Boolean LogInEnabled { get { return logInToolStripMenuItem.Enabled; } set { logInToolStripMenuItem.Enabled = value; } }
26  public Boolean LogOutEnabled { get { return logOutToolStripMenuItem.Enabled; } set { logOutToolStripMenuItem.Enabled = value; } }
27 
28  public Menu()
29  {
31  }
32 
33  private void newToolStripMenuItem_Click(object sender, EventArgs e)
34  {
35  if (OnNewClicked != null)
36  {
37  OnNewClicked(sender, new RoutedEventArgs());
38  }
39  }
40 
41  private void openToolStripMenuItem_Click(object sender, EventArgs e)
42  {
43  if (OnOpenClicked != null)
44  {
45  OnOpenClicked(sender, new RoutedEventArgs());
46  }
47  }
48 
49  private void saveToolStripMenuItem_Click(object sender, EventArgs e)
50  {
51  if (OnSaveClicked != null)
52  {
53  OnSaveClicked(sender, new RoutedEventArgs());
54  }
55  }
56 
57  private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
58  {
59  if (OnSaveAsClicked != null)
60  {
61  OnSaveAsClicked(sender, new RoutedEventArgs());
62  }
63  }
64 
65  private void exitToolStripMenuItem_Click(object sender, EventArgs e)
66  {
67  if (OnExitClicked != null)
68  {
69  OnExitClicked(sender, new RoutedEventArgs());
70  }
71  }
72 
73  private void logInToolStripMenuItem_Click(object sender, EventArgs e)
74  {
75  if (OnLoginClicked != null)
76  {
77  OnLoginClicked(sender, new RoutedEventArgs());
78  }
79  }
80 
81  private void logOutToolStripMenuItem_Click(object sender, EventArgs e)
82  {
83  if (OnLogoutClicked != null)
84  {
85  OnLogoutClicked(sender, new RoutedEventArgs());
86  }
87  }
88 
89  private void OnRecentConfig_Click(object sender, EventArgs e)
90  {
91  if (OnRecentConfigClicked != null)
92  {
93  OnRecentConfigClicked(sender, new RoutedEventArgs());
94  }
95  }
96 
97  public void AddRecentConfigs(List<String> recent)
98  {
99  recentConfigurationsToolStripMenuItem.DropDownItems.Clear();
100 
101  if (recent.Count > 0)
102  {
103  for (int i = 0; i < recent.Count; ++i)
104  {
105  if (!String.IsNullOrEmpty(recent[i]))
106  {
107  ToolStripMenuItem temp = new ToolStripMenuItem();
108  temp.Name = recent[i];
109  temp.Text = recent[i];
110  temp.Click += new EventHandler(OnRecentConfig_Click);
111  recentConfigurationsToolStripMenuItem.DropDownItems.Add(temp);
112  }
113  }
114 
115  recentConfigurationsToolStripMenuItem.Visible = true;
116  }
117  else
118  {
119  recentConfigurationsToolStripMenuItem.Visible = false;
120  }
121  }
122  }
123 }
Boolean LogOutEnabled
Definition: Menu.cs:26
void AddRecentConfigs(List< String > recent)
Definition: Menu.cs:97
void logOutToolStripMenuItem_Click(object sender, EventArgs e)
Definition: Menu.cs:81
void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
Definition: Menu.cs:57
RoutedEventHandler OnLoginClicked
Definition: Menu.cs:20
RoutedEventHandler OnSaveClicked
Definition: Menu.cs:17
Boolean LogInEnabled
Definition: Menu.cs:25
void exitToolStripMenuItem_Click(object sender, EventArgs e)
Definition: Menu.cs:65
void InitializeComponent()
Required method for Designer support - do not modify the contents of this method with the code editor...
RoutedEventHandler OnExitClicked
Definition: Menu.cs:19
void newToolStripMenuItem_Click(object sender, EventArgs e)
Definition: Menu.cs:33
void logInToolStripMenuItem_Click(object sender, EventArgs e)
Definition: Menu.cs:73
void saveToolStripMenuItem_Click(object sender, EventArgs e)
Definition: Menu.cs:49
RoutedEventHandler OnOpenClicked
Definition: Menu.cs:16
RoutedEventHandler OnLogoutClicked
Definition: Menu.cs:21
void OnRecentConfig_Click(object sender, EventArgs e)
Definition: Menu.cs:89
RoutedEventHandler OnRecentConfigClicked
Definition: Menu.cs:23
RoutedEventHandler OnSaveAsClicked
Definition: Menu.cs:18
RoutedEventHandler OnNewClicked
Definition: Menu.cs:15
void openToolStripMenuItem_Click(object sender, EventArgs e)
Definition: Menu.cs:41