/// <summary> /// Method to handle window loaded event. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">Event arguments.</param> private void MainWindow_Loaded(object sender, RoutedEventArgs e) { // Load Menu XmlRootAttribute xmlRootAttribute = new XmlRootAttribute("MenuDataItems"); XmlSerializer serializer = new XmlSerializer(typeof(ObservableCollection<MenuDataItem>), xmlRootAttribute); using (XmlReader reader = XmlReader.Create(FilePath.GetAbsolutePath("Menu.xml"))) { m_menuDataItems = (ObservableCollection<MenuDataItem>)serializer.Deserialize(reader); } MenuMain.DataContext = m_menuDataItems; // Populate Node Dropdown Dictionary<Guid, string> nodesList = Node.GetLookupList(null); ComboboxNode.ItemsSource = nodesList; if (ComboboxNode.Items.Count > 0) { if (!string.IsNullOrEmpty(m_defaultNodeID) && nodesList.ContainsKey(new Guid(m_defaultNodeID))) { foreach (KeyValuePair<Guid, string> item in nodesList) { if (item.Key.ToString().ToLower() == m_defaultNodeID.ToLower()) { ComboboxNode.SelectedItem = item; break; } } } else ComboboxNode.SelectedIndex = 0; } // Create alarm monitor as singleton m_alarmMonitor = new AlarmMonitor(true); m_alarmMonitor.Start(); IsolatedStorageManager.InitializeIsolatedStorage(false); }
/// <summary> /// Method to handle window loaded event. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">Event arguments.</param> private void MainWindow_Loaded(object sender, RoutedEventArgs e) { // Load Menu XmlRootAttribute xmlRootAttribute = new XmlRootAttribute("MenuDataItems"); XmlSerializer serializer = new XmlSerializer(typeof(ObservableCollection<MenuDataItem>), xmlRootAttribute); using (XmlReader reader = XmlReader.Create(FilePath.GetAbsolutePath("Menu.xml"))) { m_menuDataItems = (ObservableCollection<MenuDataItem>)serializer.Deserialize(reader); } MenuMain.DataContext = m_menuDataItems; // Populate Node Dropdown ComboboxNode.ItemsSource = Node.GetLookupList(null); if (ComboboxNode.Items.Count > 0) ComboboxNode.SelectedIndex = 0; // Create alarm monitor as singleton m_alarmMonitor = new AlarmMonitor(true); m_alarmMonitor.Start(); IsolatedStorageManager.InitializeIsolatedStorage(false); }