public KHR_1HV_MotionFile()
        {
            khr_1hv_motion = new IniFile("");
            IniSection section = new IniSection();

            section.Add("Type", "0");
            section.Add("Width", "854");
            section.Add("Height", "480");
            section.Add("Items", "0");
            section.Add("Links", "0");
            section.Add("Start", "-1");
            section.Add("Name", "");
            section.Add("Ctrl", "65535");
            khr_1hv_motion.Add("GraphicalEdit", section);
        }
Ejemplo n.º 2
0
        void cmdMnuControl_TrimFileDialogPressed(object sender, TrimCommandMenu.TrimFileDialogEventsArgs e)
        {
            if (e.Filedialog == "Open")
            {
                string _fileName = string.Empty;
                this.openFD.Title = "Open a Robot Trim File";
                this.openFD.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                this.openFD.FileName = string.Empty;
                this.openFD.Filter = "Robot Trim files|*.rcb|All files|*.*";
                if (this.openFD.ShowDialog() != DialogResult.Cancel)
                {
                    trimFile = new IniFile(this.openFD.FileName);
                    if (trimFile.Exists())
                    {
                        if (trimFile.Load())
                        {
                            try
                            {
                                // Load the selected trim file
                                saServo = trimFile["Trim"]["Prm"].Split(',');
                                // Position the sliders on the UI
                                trimservosSlider(saServo);
                                // Send the servo trim values to the server
                                trimservos.changeAllChannels(saServo);
                            }
                            catch
                            {
                                MessageBox.Show("No Trim file...");
                            }
                        }
                    }
                }

            }
            else if (e.Filedialog == "Save")
            {
                string str = string.Empty;
                string[] strArray = new string[StaticUtilities.numberOfServos];
                for (int i = 0; i < StaticUtilities.numberOfServos; i++)
                {
                    strArray[i] = horizontalSliderArray[i].sliderValue.ToString();
                }
                str = string.Join(",", strArray);
                this.saveFD.InitialDirectory = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                this.saveFD.Title = "Save the Robot Trim File";
                this.saveFD.Filter = "Robot Trim Files|*.rcb|All files|*.*";
                this.saveFD.AddExtension = true;
                if (this.saveFD.ShowDialog() != DialogResult.Cancel)
                {
                    trimFile = new IniFile(this.saveFD.FileName);
                    IniSection section = new IniSection();
                    section.Add("Prm", str);
                    trimFile.Add("Trim", section);
                    trimFile.Save();
                }
            }
        }
Ejemplo n.º 3
0
        //=======================
        //  DEFAULT CONSTRUCTOR
        //=======================
        public KHR_1HV_IniFile()
        {
            khr_1hv_ini = new IniFile("./KHR-1HV.ini");
            if (khr_1hv_ini.Exists())
                khr_1hv_ini.Load();
            else
            {
                IniSection section = new IniSection();
                section.Add("IPAddress", "0.0.0.0");
                section.Add("Grid", "1");
                section.Add("GridWidth", "5");
                section.Add("GridHeight", "5");
                section.Add("Form", "804,900,-2147483633");
                section.Add("Bmp", "");
                section.Add("Background", "0");
                section.Add("CH1", "1,0,0,-2147483633,0,1,CH1");
                section.Add("CH2", "1,0,31,-2147483633,0,1,CH2");
                section.Add("CH3", "1,0,62,-2147483633,0,1,CH3");
                section.Add("CH4", "1,0,93,-2147483633,0,1,CH4");
                section.Add("CH5", "1,0,124,-2147483633,0,1,CH5");
                section.Add("CH6", "1,0,155,-2147483633,0,1,CH6");
                section.Add("CH7", "1,0,186,-2147483633,0,1,CH7");
                section.Add("CH8", "1,0,217,-2147483633,0,1,CH8");
                section.Add("CH9", "1,0,248,-2147483633,0,1,CH9");
                section.Add("CH10", "1,0,279,-2147483633,0,1,CH10");
                section.Add("CH11", "1,0,310,-2147483633,0,1,CH11");
                section.Add("CH12", "1,0,341,-2147483633,0,1,CH12");
                section.Add("CH13", "1,329,0,-2147483633,0,1,CH13");
                section.Add("CH14", "1,329,31,-2147483633,0,1,CH14");
                section.Add("CH15", "1,329,62,-2147483633,0,1,CH15");
                section.Add("CH16", "1,329,93,-2147483633,0,1,CH16");
                section.Add("CH17", "1,329,124,-2147483633,0,1,CH17");
                section.Add("CH18", "1,329,155,-2147483633,0,1,CH18");
                section.Add("CH19", "1,329,186,-2147483633,0,1,CH19");
                section.Add("CH20", "1,329,217,-2147483633,0,1,CH20");
                section.Add("CH21", "1,329,248,-2147483633,0,1,CH21");
                section.Add("CH22", "1,329,279,-2147483633,0,1,CH22");
                section.Add("CH23", "1,329,310,-2147483633,0,1,CH23");
                section.Add("CH24", "1,329,341,-2147483633,0,1,CH24");
                section.Add("SPEED", "1,0,372,-2147483633");
                section.Add("CMD", "1,0,403,-2147483633");
                section.Add("LINK", "1,329,372,-2147483633");
                khr_1hv_ini.Add("KHR-1HV", section);

                khr_1hv_ini.Save();
            }
        }