Exemple #1
0
        private void appendToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Log.Logger.Debug("設定項目追加");

            if (IsChange)
            {
                if (MessageBox.Show("変更内容を破棄して新規追加しますか?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
                {
                    return;
                }
            }

            ConfigItem cron = new ConfigItem();

            configItems.Add(cron);
            configListView.Items.Add(new ListViewItem(new string[] {
                cron.Name,
                cron.GetTiming(),
                cron.GetCommand(),
                cron.Enable.ToString()
            }));
            IsChange = false;

            SelectIndex = configListView.Items.Count - 1;
            configListView.Items[SelectIndex].Selected = true;
            configGroupBox.Enabled = true;
        }
Exemple #2
0
        private void configListView_SelectedIndexChanged(object sender, EventArgs e)
        {
            Log.Logger.Debug("設定項目変更");
            if (configListView.SelectedItems.Count > 0)
            {
                if (IsChange)
                {
                    if (SelectIndex != configListView.SelectedItems[0].Index)
                    {
                        if (MessageBox.Show("変更内容を破棄して表示しますか?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) != DialogResult.OK)
                        {
                            if (SelectIndex >= 0)
                            {
                                configListView.SelectedIndexChanged       -= new System.EventHandler(this.configListView_SelectedIndexChanged);
                                configListView.Items[SelectIndex].Selected = true;
                                configListView.SelectedIndexChanged       += new System.EventHandler(this.configListView_SelectedIndexChanged);
                            }
                            return;
                        }
                    }
                }

                Log.Logger.Debug("設定再展開");
                SelectIndex = configListView.SelectedItems[0].Index;
                ConfigItem cron = configItems[SelectIndex];


                enabledCheckBox.Checked = cron.Enable;
                nameTextBox.Text        = cron.Name;
                explainTextBox.Text     = cron.Explain;
                timingTextBox.Text      = cron.GetTiming();
                filepathTextBox.Text    = cron.Path;
                paramTextBox.Text       = cron.Param;

                IsChange = false;
            }
        }