コード例 #1
0
ファイル: Settings.cs プロジェクト: AaronCLH/micado
 internal static void ExportCurrentSettings(Settings settings)
 {
     FileInfo currentFileInfo = new FileInfo(CurrentFilePath);
     if (!currentFileInfo.Directory.Exists)
     {
         Directory.CreateDirectory(currentFileInfo.DirectoryName);
     }
     ExportSettings(settings, CurrentFilePath);
 }
コード例 #2
0
ファイル: Settings.cs プロジェクト: AaronCLH/micado
 internal static void ExportSettings(Settings settings, string filepath)
 {
     StreamWriter SW = File.CreateText(filepath);
     SW.Write(SerializeObject(settings));
     SW.Close();
 }
コード例 #3
0
ファイル: SettingsUI.cs プロジェクト: AaronCLH/micado
        private void RecordSettings(Settings settings)
        {
            settings.FlowLayers = GetCheckedItems(checkedListBoxFlowLayers);
            settings.ControlLayers = GetCheckedItems(checkedListBoxControlLayers);

            int outint;
            double outdouble;

            if (int.TryParse(textBoxPunchBarNumber.Text, out outint))
                settings.PunchBarNumber = outint;
            if (double.TryParse(textBoxPunchBarWidth.Text, out outdouble))
                settings.PunchBarWidth = outdouble;
            if (double.TryParse(textBoxPunchRadius.Text, out outdouble))
                settings.PunchRadius = outdouble;

            if (double.TryParse(textBoxValveRelativeWidth.Text, out outdouble))
                settings.ValveRelativeWidth = outdouble;
            if (double.TryParse(textBoxValveRelativeHeight.Text, out outdouble))
                settings.ValveRelativeHeight = outdouble;
            
            if (double.TryParse(textBoxResolution.Text, out outdouble))
                settings.Resolution = outdouble;
            if (double.TryParse(textBoxConnectionWidth.Text, out outdouble))
                settings.ConnectionWidth = outdouble;
            if (double.TryParse(textBoxFlowExtraWidth.Text, out outdouble))
                settings.FlowExtraWidth = outdouble;
            if (double.TryParse(textBoxValveExtraWidth.Text, out outdouble))
                settings.ValveExtraWidth = outdouble;
            if (double.TryParse(textBoxControlLineExtraWidth.Text, out outdouble))
                settings.ControlLineExtraWidth = outdouble;
            if (double.TryParse(textBoxPunch2Line.Text, out outdouble))
                settings.Punch2Line = outdouble;
        }
コード例 #4
0
ファイル: SettingsUI.cs プロジェクト: AaronCLH/micado
        private void buttonExport_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
            sfd.Filter = "micado settings (*.xml)|*.xml";
            sfd.Title = "Export Micado Settings";

            if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            string filepath = sfd.FileName;

            Settings settings = new Settings();
            RecordSettings(settings);
            Settings.ExportSettings(settings, filepath);
        }
コード例 #5
0
ファイル: SettingsUI.cs プロジェクト: AaronCLH/micado
        private void LoadSettings(Settings settings)
        {
            SetCheckedListBox(checkedListBoxFlowLayers, settings.FlowLayers);
            SetCheckedListBox(checkedListBoxControlLayers, settings.ControlLayers);
            
            textBoxPunchBarNumber.Text = settings.PunchBarNumber.ToString();
            textBoxPunchBarWidth.Text = settings.PunchBarWidth.ToString();
            textBoxPunchRadius.Text = settings.PunchRadius.ToString();

            textBoxValveRelativeWidth.Text = settings.ValveRelativeWidth.ToString();
            textBoxValveRelativeHeight.Text = settings.ValveRelativeHeight.ToString();

            textBoxResolution.Text = settings.Resolution.ToString();
            textBoxConnectionWidth.Text = settings.ConnectionWidth.ToString();
            textBoxFlowExtraWidth.Text = settings.FlowExtraWidth.ToString();
            textBoxValveExtraWidth.Text = settings.ValveExtraWidth.ToString();
            textBoxControlLineExtraWidth.Text = settings.ControlLineExtraWidth.ToString();
            textBoxPunch2Line.Text = settings.Punch2Line.ToString();
        }