예제 #1
0
 public void RemoveTab(ClientTab clientTab)
 {
     if (InvokeRequired)
     {
         Invoke((MethodInvoker) delegate()
         {
             /* if (clientTab.SettingsThread != null)
              * {
              *   clientTab.SettingsThread.Abort();
              *   clientTab.SettingsThread.Join();
              *   clientTab.SettingsThread = (Thread)null;
              * }*/
             if (clientTab.reg != null)
             {
                 clientTab.reg.Unregister(clientTab.waypointsThreadWaitHandle);
             }
             clientTab.Dispose();
         });
     }
     else
     {
         /*if (clientTab.SettingsThread != null)
          * {
          *  clientTab.SettingsThread.Abort();
          *  clientTab.SettingsThread.Join();
          *  clientTab.SettingsThread = (Thread)null;
          * }*/
         if (clientTab.reg != null)
         {
             clientTab.reg.Unregister(clientTab.waypointsThreadWaitHandle);
         }
         clientTab.Dispose();
     }
 }
예제 #2
0
 public MapPreview(ClientTab Tab)
 {
     //this.InitializeComponent();
     this.Tab        = Tab;
     this.MapDimList = Tab.mapDimList;
     myDAMap.Client  = Tab.Client;
 }
예제 #3
0
        public void LoadCharacterControls(ClientTab tab)
        {
            Dictionary <string, Dictionary <string, object> > varCharacterSettings = MySettings.Load();

            List <Control> clientControls = new List <Control>();
            Dictionary <string, object> characterIndex = new Dictionary <string, object>();

            tab.RecursiveAllControls(tab, ref clientControls);

            foreach (var character in varCharacterSettings)
            {
                if (character.Key.Equals(tab.Client.Base.Me.Name.ToLower()))
                {
                    characterIndex = character.Value;
                }
            }
            foreach (var control in characterIndex)
            {
                foreach (var cControl in clientControls)
                {
                    /*We need to make this check all types of window forms, is there a better way than hard coding it? Dont forget to do the same for save*/
                    if (cControl.Name.Equals(control.Key))
                    {
                        if (cControl is TextBox)
                        {
                            (cControl as TextBox).Text = control.Value.ToString();
                        }
                        else if (cControl is ListBox)
                        {
                            (cControl as ListBox).Text = control.Value.ToString();
                        }
                        else if (cControl is ComboBox)
                        {
                            (cControl as ComboBox).Text = control.Value.ToString();
                        }
                        else if (cControl is CheckBox)
                        {
                            (cControl as CheckBox).Checked = (bool)control.Value;
                        }
                        else if (cControl is RadioButton)
                        {
                            (cControl as RadioButton).Checked = (bool)control.Value;
                        }
                        else if (cControl is TrackBar)
                        {
                            (cControl as TrackBar).Value = (int)control.Value;
                        }
                        else if (cControl is NumericUpDown)
                        {
                            (cControl as NumericUpDown).Value = (int)control.Value;
                        }
                    }
                }
            }
        }
예제 #4
0
 public void AddTab(ClientTab clientTab)
 {
     if (InvokeRequired)
     {
         Invoke((MethodInvoker) delegate()
         {
             mainTabControl.TabPages.Add(clientTab);
         });
     }
     else
     {
         mainTabControl.TabPages.Add(clientTab);
     }
 }
예제 #5
0
 private void carButton_Clicked(object sender, EventArgs e)
 {
     _tab = ClientTab.CarTab;
     driveButton.BackgroundColor = Color.LightSlateGray;
     headButton.BackgroundColor  = Color.LightSlateGray;
     carButton.BackgroundColor   = Color.LightGray;
     button11.Text = "Left LED";
     button12.Text = "Strip LED";
     button13.Text = "Right LED";
     button21.Text = "Manual";
     button22.Text = "Set Mode";
     button23.Text = "Scan";
     DisplayLightStatus();
 }
예제 #6
0
 private void headButton_Clicked(object sender, EventArgs e)
 {
     _tab = ClientTab.HeadTab;
     driveButton.BackgroundColor = Color.LightSlateGray;
     headButton.BackgroundColor  = Color.LightGray;
     carButton.BackgroundColor   = Color.LightSlateGray;
     button11.Text            = "Look Left";
     button12.Text            = "Look Up";
     button13.Text            = "Look Right";
     button21.Text            = "Ahead";
     button22.Text            = "Down";
     button23.Text            = "Distance";
     button12.BackgroundColor = Color.LightGray;
 }
예제 #7
0
 private void driveButton_Clicked(object sender, EventArgs e)
 {
     _tab = ClientTab.DriveTab;
     driveButton.BackgroundColor = Color.LightGray;
     headButton.BackgroundColor  = Color.LightSlateGray;
     carButton.BackgroundColor   = Color.LightSlateGray;
     button12.BackgroundColor    = Color.LightGray;
     button11.Text = "Left";
     button12.Text = "Right";
     button13.Text = "Forward";
     button21.Text = "";
     button22.Text = "";
     button23.Text = "Backward";
 }
예제 #8
0
파일: Map.cs 프로젝트: averes2/Russia-Next
        public Map(ClientTab tab, short number, int width, int height)
        {
            this.Width  = width;
            this.Height = height;
            this.Number = number;
            this.Grid   = new Tile[width, height];
            this.Matrix = new Tile[width + 1, height + 1];
            this.Tab    = tab;
            DateTime now  = DateTime.Now;
            bool     flag = false;

            do
            {
                if (this.Initlize())
                {
                    break;
                }
            }while ((DateTime.Now - now).TotalSeconds < 25.0);
            if (!flag)
            {
                ;
            }
        }
예제 #9
0
        public void SaveCharacterControls(ClientTab tab)
        {
            Dictionary <string, Dictionary <string, object> > varCharacterSettings = MySettings.Load();
            //MySettings settings = MySettings.Load();

            Dictionary <string, object> controlSettings = new Dictionary <string, object>();

            List <Control> refControls = new List <Control>();

            tab.RecursiveAllControls(tab, ref refControls);

            //if value is in varCharacterSettings update it and hold it for json serialization
            /*We need to make this check all types of window forms, is there a better way than hard coding it? Dont forget to do the same for load*/
            foreach (Control innerControl in refControls)
            {
                string value = "";

                if (innerControl is TextBox || innerControl is System.Windows.Forms.ComboBox || innerControl is ListBox)
                {
                    PropertyInfo info      = innerControl.GetType().GetProperty("Text");
                    string       infoValue = info.GetValue(innerControl, null).ToString();
                    value = infoValue;
                    if (!controlSettings.ContainsKey(innerControl.Name))
                    {
                        controlSettings.Add(innerControl.Name, infoValue);
                    }
                    else
                    {
                        controlSettings[innerControl.Name] = infoValue;
                    }
                }
                else if (innerControl is CheckBox || innerControl is RadioButton)
                {
                    PropertyInfo info      = innerControl.GetType().GetProperty("Checked");
                    bool         infoValue = (bool)info.GetValue(innerControl, null);
                    value = infoValue.ToString();
                    if (!controlSettings.ContainsKey(innerControl.Name))
                    {
                        controlSettings.Add(innerControl.Name, infoValue);
                    }
                    else
                    {
                        controlSettings[innerControl.Name] = infoValue;
                    }
                }
                else if (innerControl is NumericUpDown || innerControl is TrackBar)
                {
                    PropertyInfo info      = innerControl.GetType().GetProperty("Value");
                    object       infoValue = (object)info.GetValue(innerControl, null);
                    value = infoValue.ToString();
                    if (!controlSettings.ContainsKey(innerControl.Name))
                    {
                        controlSettings.Add(innerControl.Name, infoValue);
                    }
                    else
                    {
                        controlSettings[innerControl.Name] = infoValue;
                    }
                }
                //if (controlSettings.ContainsKey(innerControl.Name))
                //    tab.Client.SendMessage(controlSettings[innerControl.Name] + " " + innerControl.Name, (byte)0);
            }

            if (!varCharacterSettings.ContainsKey(tab.Client.Base.Me.Name.ToLower()))
            {
                varCharacterSettings.Add(tab.Client.Base.Me.Name.ToLower(), controlSettings);
            }
            else //update the character settings
            {
                varCharacterSettings[tab.Client.Base.Me.Name.ToLower()] = controlSettings;
            }

            if (!tab.Client.Base.Me.Name.Equals("noname"))
            {
                MySettings.Save(varCharacterSettings);
            }
        }