コード例 #1
0
ファイル: Form1.cs プロジェクト: weimingtom/pap2
        public Form1()
        {
            InitializeComponent();

            // 初始化数据表
            TabFile.EventData     = new TabFileData("Settings\\EventDefine.tab", "EventID");
            TabFile.ConditionData = new TabFileData("Settings\\ConditionDefine.tab", "ConditionID");

            // 初始化选择器
            formEventSelector     = new EventSelector();
            formConditionSelector = new ConditionSelector();
            formActionSelector    = new ActionSelector();
            formHelpWindow        = new HelpWindow();

            // 初始化修改器
            conditionDefineEditor = new ConditionDefineEditor();

            // 初始化 Condition Tree
            groupBox2.Enabled = false;

            // 初始化 Config
            string szConfigFileName = Directory.GetCurrentDirectory() + @"\Config.ini";

            iniConfig = new INIFile(szConfigFileName);
            if (File.Exists(szConfigFileName) == false)
            {
                // 如果没有 Config 文件则创建一个带有默认值的 Config
                iniConfig.SetValue(szSection, "AutoLoadEventTreeWhenStartUp", "1");
                iniConfig.SetValue(szSection, "AutoSaveEventTreeWhenExchangeEventItem", "1");
                iniConfig.SetValue(szSection, "LastSavedFileName", "");
            }

            if (iniConfig.GetValue(szSection, "AutoLoadEventTreeWhenStartUp") == "1")
            {
                checkBox2.Checked = true;
                string szLastSavedFileName = iniConfig.GetValue(szSection, "LastSavedFileName");
                if (File.Exists(szLastSavedFileName) == true)
                {
                    LoadEventTreeByFile(szLastSavedFileName);
                }
            }
            else
            {
                checkBox2.Checked = false;
            }

            if (iniConfig.GetValue(szSection, "AutoSaveEventTreeWhenExchangeEventItem") == "1")
            {
                checkBox1.Checked = true;
            }
            else
            {
                checkBox1.Checked = false;
            }

            // TEST
            //conditionDefineEditor.ShowDialog();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: viticm/pap2
        public Form1()
        {
            InitializeComponent();

            // 初始化数据表
            TabFile.EventData = new TabFileData("Settings\\EventDefine.tab", "EventID");
            TabFile.ConditionData = new TabFileData("Settings\\ConditionDefine.tab", "ConditionID");

            // 初始化选择器
            formEventSelector = new EventSelector();
            formConditionSelector = new ConditionSelector();
            formActionSelector = new ActionSelector();
            formHelpWindow = new HelpWindow();

            // 初始化修改器
            conditionDefineEditor = new ConditionDefineEditor();

            // 初始化 Condition Tree
            groupBox2.Enabled = false;

            // 初始化 Config
            string szConfigFileName = Directory.GetCurrentDirectory() + @"\Config.ini";
            iniConfig = new INIFile(szConfigFileName);
            if (File.Exists(szConfigFileName) == false)
            {
                // 如果没有 Config 文件则创建一个带有默认值的 Config
                iniConfig.SetValue(szSection, "AutoLoadEventTreeWhenStartUp", "1");
                iniConfig.SetValue(szSection, "AutoSaveEventTreeWhenExchangeEventItem", "1");
                iniConfig.SetValue(szSection, "LastSavedFileName", "");
            }

            if (iniConfig.GetValue(szSection, "AutoLoadEventTreeWhenStartUp") == "1")
            {
                checkBox2.Checked = true;
                string szLastSavedFileName = iniConfig.GetValue(szSection, "LastSavedFileName");
                if (File.Exists(szLastSavedFileName) == true)
                    LoadEventTreeByFile(szLastSavedFileName);
            }
            else
                checkBox2.Checked = false;

            if (iniConfig.GetValue(szSection, "AutoSaveEventTreeWhenExchangeEventItem") == "1")
                checkBox1.Checked = true;
            else
                checkBox1.Checked = false;

            // TEST
            //conditionDefineEditor.ShowDialog();
        }
コード例 #3
0
ファイル: ConditionSelector.cs プロジェクト: weimingtom/pap2
        private void button3_Click(object sender, EventArgs e)
        {
            ConditionDefineEditor conditionDefineEditor = new ConditionDefineEditor();

            conditionDefineEditor.ChangeSelectedTab(1);

            // 选中当前相关的行
            DorpDownListItem dorpDownListItem = (DorpDownListItem)comboBox3.SelectedItem;

            conditionDefineEditor.ChangeSelectedRow(dorpDownListItem.Value);

            if (conditionDefineEditor.ShowDialog() == DialogResult.OK)      // 这里刷新面板以出现新的内容
            {
                // TODO: 考虑是否自动选中刚配置的项或者刷新后也回复刷新前的选择状态(下面的三行代码会强制保存, 不满足条件)
                //TreeNode SourceNode = (TreeNode)this.Tag;
                //Form1 form1 = (Form1)SourceNode.TreeView.FindForm();
                //form1.SaveConditionPageData();
                ConditionSelector_Load(sender, e);
            }

            conditionDefineEditor.Dispose();
        }
コード例 #4
0
ファイル: ConditionSelector.cs プロジェクト: viticm/pap2
        private void button3_Click(object sender, EventArgs e)
        {
            ConditionDefineEditor conditionDefineEditor = new ConditionDefineEditor();
            conditionDefineEditor.ChangeSelectedTab(1);

            // 选中当前相关的行
            DorpDownListItem dorpDownListItem = (DorpDownListItem)comboBox3.SelectedItem;
            conditionDefineEditor.ChangeSelectedRow(dorpDownListItem.Value);

            if (conditionDefineEditor.ShowDialog() == DialogResult.OK)      // 这里刷新面板以出现新的内容
            {
                // TODO: 考虑是否自动选中刚配置的项或者刷新后也回复刷新前的选择状态(下面的三行代码会强制保存, 不满足条件)
                //TreeNode SourceNode = (TreeNode)this.Tag;
                //Form1 form1 = (Form1)SourceNode.TreeView.FindForm();
                //form1.SaveConditionPageData();
                ConditionSelector_Load(sender, e);
            }

            conditionDefineEditor.Dispose();
        }