コード例 #1
0
        /// <summary>
        /// グラフ設定ボタンクリック
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void graphSettingButton_Click(object sender, EventArgs e)
        {
            GraphSettingForm settingForm = new GraphSettingForm();

            if (settingForm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                this.graphSettings = settingForm.graphSettings;

                List <ItemBean>[] itemLists = new List <ItemBean>[] { chart1Items, chart2Items, chart3Items };

                for (int i = 0; i < graphViews.Length; i++)
                {
                    GraphView       graphView = graphViews[i];
                    List <ItemBean> itemList  = itemLists[i];

                    graphView.GraphBackColor     = settingForm.GraphBackColor;
                    graphView.Gradation          = settingForm.Gradation;
                    graphView.YAxisTitleFontSize = settingForm.AxisFontSize;
                    graphView.YAxisScaleFontSize = settingForm.AxisFontSize;
                    graphView.XAxisTitleFontSize = settingForm.AxisFontSize;
                    graphView.XAxisScaleFontSize = settingForm.AxisFontSize;
                    graphView.TitleFontSize      = settingForm.TitleFontSize;
                    graphView.TitleColor         = settingForm.TitleColor;

                    for (int j = 0; j < itemList.Count; j++)
                    {
                        itemList[j].LineWidth = settingForm.LineWidth;
                        graphView.ItemWidthChanged(itemList[j]);
                    }
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public SettingForm(SettingTable settingTable)
        {
            InitializeComponent();

            this.settings = settingTable;

            //string defaultPath = Path.Combine(System.Windows.Forms.Application.LocalUserAppDataPath, "SensorData");
            //String defaultPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
            //                    Application.CompanyName, Application.ProductName, "SensorData");

            string sensorDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                                 System.Windows.Forms.Application.CompanyName,
                                                 //System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion,
                                                 "MEME academic",
                                                 "SensorData");

            // ファイル保存フォルダ確認
            this.saveFolder = this.settings.GetStringValue("OperationSetting", "SaveFolder", sensorDataPath);
            if (Directory.Exists(this.saveFolder) == false)
            {
                this.saveFolder = sensorDataPath;
                if (Directory.Exists(this.saveFolder) == false)
                {
                    // フォルダを作成
                    Directory.CreateDirectory(this.saveFolder);
                }
            }

            // ファイル保存ダイアログ表示設定
            this.showSaveFileDialog = this.settings.GetBool("OperationSetting", "ShowSaveFileDialog", this.showSaveFileDialog);

            // 外部出力ソケット使用
            this.useSocket = this.settings.GetBool("OperationSetting", "UseSocket", this.useSocket);

            // 外部出力ソケットローカルポート
            this.socketPort = this.settings.GetInteger("OperationSetting", "SocketPort", this.socketPort);

            // 外部出力ソケットローカルアドレス
            this.socketAddress = this.settings.GetStringValue("OperationSetting", "SocketAddress", this.socketAddress);

            // ローカルアドレス一覧取得
            bool match = false;

            IPAddress[] ipAddress = Dns.GetHostEntry(Dns.GetHostName()).AddressList;
            for (int index = 0; index < ipAddress.Length; index++)
            {
                if (ipAddress[index].AddressFamily != AddressFamily.InterNetwork)
                {
                    continue;
                }
                if (this.socketAddress.Equals(ipAddress[index].ToString()))
                {
                    match = true;
                    this.socketAddressCombo.Items.Insert(0, ipAddress[index].ToString());
                }
                else
                {
                    this.socketAddressCombo.Items.Add(ipAddress[index].ToString());
                }
            }
            if (match)
            {
                this.socketAddressCombo.SelectedIndex = 0;
            }
            else
            {
                this.socketAddress = string.Empty;
                this.socketAddressCombo.SelectedIndex = -1;
            }

            // マーキング時間確認
            this.markingTimeValue = this.settings.GetInteger("OperationSetting", "MarkingTime", this.markingTimeValue);
            if (this.markingTimeValue < 0)
            {
                this.markingTimeValue = 0;
            }

            // ファイル日付フォーマット確認
            this.recordFileDateFormat = this.settings.GetInteger("OperationSetting", "RecordFileDateFormat", this.recordFileDateFormat);

            // 加速度オフセット取得
            this.accXAxisOffset = this.settings.GetInteger("OperationSetting", "AccXAxisOffset", this.accXAxisOffset);
            this.accYAxisOffset = this.settings.GetInteger("OperationSetting", "AccYAxisOffset", this.accYAxisOffset);
            this.accZAxisOffset = this.settings.GetInteger("OperationSetting", "AccZAxisOffset", this.accZAxisOffset);
        }
コード例 #3
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public BaseForm()
        {
            InitializeComponent();

            settings = new SettingTable(this.GetType().Name);
        }