Exemplo n.º 1
0
        private void BUT_paramfileload_Click(object sender, EventArgs e)
        {
            string filepath = Application.StartupPath + Path.DirectorySeparatorChar + CMB_paramfiles.Text;

            byte[] data = GitHubContent.GetFileContent("diydrones", "ardupilot", ((GitHubContent.FileInfo)CMB_paramfiles.SelectedValue).path);

            File.WriteAllBytes(filepath, data);

            Hashtable param2 = Utilities.ParamFile.loadParamFile(filepath);

            Form paramCompareForm = new ParamCompare(null, MainV2.comPort.MAV.param, param2);

            ThemeManager.ApplyThemeTo(paramCompareForm);
            paramCompareForm.ShowDialog();

            CustomMessageBox.Show("Loaded parameters!", "Loaded");

            this.Activate();
        }
Exemplo n.º 2
0
        private void BUT_paramfileload_Click(object sender, EventArgs e)
        {
            string filepath = Application.StartupPath + Path.DirectorySeparatorChar + CMB_paramfiles.Text;

            if (CMB_paramfiles.SelectedValue == null)
            {
                CustomMessageBox.Show("Please select an option first");
                return;
            }

            try
            {
                byte[] data = GitHubContent.GetFileContent("ardupilot", "ardupilot",
                                                           ((GitHubContent.FileInfo)CMB_paramfiles.SelectedValue).path);

                File.WriteAllBytes(filepath, data);

                Hashtable param2 = Utilities.ParamFile.loadParamFile(filepath);

                Form paramCompareForm = new ParamCompare(null, MainV2.comPort.MAV.param, param2);

                ThemeManager.ApplyThemeTo(paramCompareForm);
                if (paramCompareForm.ShowDialog() == DialogResult.OK)
                {
                    CustomMessageBox.Show("Loaded parameters!", "Loaded");
                }

                if (OnChange != null)
                {
                    OnChange(null, null);
                    return;
                }

                this.Activate();
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show("Failed to load file.\n" + ex);
            }
        }
Exemplo n.º 3
0
        private void BUT_compare_Click(object sender, EventArgs e)
        {
            var param2 = new Dictionary <string, double>();

            using (var ofd = new OpenFileDialog
            {
                AddExtension = true,
                DefaultExt = ".param",
                RestoreDirectory = true,
                Filter = ParamFile.FileMask
            })
            {
                var dr = ofd.ShowDialog();
                if (dr == DialogResult.OK)
                {
                    param2 = ParamFile.loadParamFile(ofd.FileName);

                    Form paramCompareForm = new ParamCompare(Params, MainV2.comPort.MAV.param, param2);

                    ThemeManager.ApplyThemeTo(paramCompareForm);
                    paramCompareForm.ShowDialog();
                }
            }
        }