private void btnLoad_Click(object sender, RoutedEventArgs e)
        {
            List<GroupSetting> loaded = new List<GroupSetting>();
            loaded = XMLHandler.load("config.xml");
            foreach (GroupSetting gs in loaded)
            {
                MonitorTab monitor = new MonitorTab();
                configScreensSaverControl.getGroupSettings().Add(gs);
                monitor.Width = 383;
                monitor.Height = 30;
                monitor.MinWidth = MonitorMenu.MinWidth;
                monitor.MaxWidth = MonitorMenu.MaxWidth;
                monitor.MouseDown += Monitor_clicked;
                monitor.order = configScreensSaverControl.getGroupSettings().Count -1;
                currentScreen = configScreensSaverControl.getTotalNumberofGroups() - 1;
                monitor.passtitleRef(ref gs.groupName);
                MonitorMenu.Children.Add(monitor);

                configScreensSaverControl.getOwnedMonitors().Add(new List<string>());
                foreach (MonitorSetting ms in gs.monitors)
                {
                    configScreensSaverControl.getOwnedMonitors()[configScreensSaverControl.getOwnedMonitors().Count - 1].Add(ms.monitorId);
                }
            }
        }
 public void controlChanged(object sender, EventArgs e)
 {
     for (int i = 0; i < main.MonitorMenu.Children.Capacity - 1; i++)
     {
         MonitorTab tab = (MonitorTab)main.MonitorMenu.Children[i];
         tab.title = String.Format("{0}   {1}\nOwned:  {2} Active:  {3}", saver.getGroupSettings(i).groupName, saver.getGroupSettings(i).ssType,
                                   saver.getGroupSettings(i).monitors.Capacity, saver.getGroupSettings(i).isActive);
         main.MonitorMenu.Children[i] = tab;
     }
 }
        private void Load_Page(object sender, RoutedEventArgs e)
        {
            nametxtbox.Text = gSetting.groupName;
            if (String.Equals(gSetting.ssType, "SlideShow", StringComparison.InvariantCultureIgnoreCase))
            {
                comboScreenSaver.SelectedIndex = 0;
            }
            else if (String.Equals(gSetting.ssType, "Maze", StringComparison.InvariantCultureIgnoreCase))
            {
                comboScreenSaver.SelectedIndex = 1;
            }

            if (gSetting.isActive)
            {
                isActive.Content = "Active";
            }
            else
            {
                isActive.Content = "Not Active";
            }

            int tmpCount = 0;

            foreach (String str in availabeString)
            {
                MonitorTab tab = new MonitorTab();
                tab.title      = str;
                tab.order      = tmpCount;
                tab.Height     = 20;
                tab.MouseDown += clicked_AvailableGroupBox;
                PendingScreens.Children.Add(tab);
                tmpCount++;
            }
            tmpCount = 1;
            foreach (String str in OwnedScreens)
            {
                MonitorTab tab = new MonitorTab();
                tab.title      = str;
                tab.order      = tmpCount;
                tab.Height     = 20;
                tab.MouseDown += clicked_AvailableGroupBox;
                abductedScreens.Children.Add(tab);

                ComboBoxItem tmpItem = new ComboBoxItem();
                tmpItem.Content = tab.title;
                tmpItem.Name    = "N" + tmpCount;
                combomonitorSelection.Items.Add(tmpItem);

                tmpCount++;
            }
        }
        private void clicked_AvailableGroupBox(object sender, EventArgs e)
        {
            MonitorTab tab     = (MonitorTab)sender;
            StackPanel parent  = (StackPanel)tab.Parent;
            string     tmpName = parent.Name;

            Debug.WriteLine(tmpName);
            if (tmpName.Equals("PendingScreens", StringComparison.OrdinalIgnoreCase))
            {
                //Display Changes
                PendingScreens.Children.Remove(tab);
                availabeString.Remove(tab.title);
                OwnedScreens.Add(tab.title);
                abductedScreens.Children.Add(tab);

                //Adding the monitor settings
                gSetting.monitors.Add(new MonitorSetting(System.Windows.Forms.Screen.AllScreens[int.Parse(tab.title.Substring(8, 1)) - 1].DeviceName));

                ComboBoxItem tmpItem = new ComboBoxItem();
                tmpItem.Content = tab.title;
                tmpItem.Name    = "N" + gSetting.monitors.Count.ToString();
                combomonitorSelection.Items.Add(tmpItem);
            }
            else if (tmpName.Equals("abductedScreens", StringComparison.OrdinalIgnoreCase))
            {
                //Diplay Changes
                ComboBoxItem tmpitem = new ComboBoxItem();

                abductedScreens.Children.Remove(tab);
                OwnedScreens.Remove(tab.title);
                availabeString.Add(tab.title);
                PendingScreens.Children.Add(tab);

                foreach (ComboBoxItem item in combomonitorSelection.Items)
                {
                    if (item.Content == tab.title)
                    {
                        tmpitem = item;
                        break;
                    }
                }
                combomonitorSelection.Items.Remove(tmpitem);

                if (combomonitorSelection.SelectedValue != null)
                {
                    int tmpStr = Int32.Parse((combomonitorSelection.SelectedValue as ComboBoxItem).Name[1].ToString()) - 1;
                    gSetting.monitors.RemoveAt(tmpStr);
                }
            }
        }
        private void Create_Button_Clicked(object sender, RoutedEventArgs e)
        {
            MonitorTab monitor = new MonitorTab();

            monitor.Width = 383;
            monitor.Height = 40;
            monitor.MinWidth = MonitorMenu.MinWidth;
            monitor.MaxWidth = MonitorMenu.MaxWidth;
            monitor.MouseDown += Monitor_clicked;
            monitor.order = configScreensSaverControl.createnewGroup();
            currentScreen = configScreensSaverControl.getTotalNumberofGroups() - 1;
            monitor.passtitleRef(ref configScreensSaverControl.getGroupSettings(monitor.order).groupName);
            MonitorMenu.Children.Add(monitor);
        }
        private void Load_Page(object sender, RoutedEventArgs e)
        {
            nametxtbox.Text = gSetting.groupName;
            if (String.Equals(gSetting.ssType,"SlideShow", StringComparison.InvariantCultureIgnoreCase))
                comboScreenSaver.SelectedIndex = 0;
            else if (String.Equals(gSetting.ssType, "Maze", StringComparison.InvariantCultureIgnoreCase))
                comboScreenSaver.SelectedIndex = 1;

            if (gSetting.isActive)
                isActive.Content = "Active";
            else
                isActive.Content = "Not Active";

            int tmpCount = 0;
            foreach (String str in availabeString)
            {
                MonitorTab tab = new MonitorTab();
                tab.title = str;
                tab.order = tmpCount;
                tab.Height = 20;
                tab.MouseDown += clicked_AvailableGroupBox;
                PendingScreens.Children.Add(tab);
                tmpCount++;
            }
            tmpCount = 1;
            foreach (String str in OwnedScreens)
            {
                MonitorTab tab = new MonitorTab();
                tab.title = str;
                tab.order = tmpCount;
                tab.Height = 20;
                tab.MouseDown += clicked_AvailableGroupBox;
                abductedScreens.Children.Add(tab);

                ComboBoxItem tmpItem = new ComboBoxItem();
                tmpItem.Content = tab.title;
                tmpItem.Name = "N" + tmpCount;
                combomonitorSelection.Items.Add(tmpItem);

                tmpCount++;
            }
        }