Esempio n. 1
0
        private void button_modifyInstance_Click(object sender, EventArgs e)
        {
            string strError = "";

            HideMessageTip();

            if (this.listView_instance.SelectedItems.Count == 0)
            {
                strError = "尚未选择要修改的事项";
                goto ERROR1;
            }

            ListViewItem item = this.listView_instance.SelectedItems[0];

            this.m_currentEditItem = item;

            OneInstanceDialog modify_instance_dlg = new OneInstanceDialog();

            GuiUtil.AutoSetDefaultFont(modify_instance_dlg);
            modify_instance_dlg.Text       = "修改一个实例";
            modify_instance_dlg.CreateMode = false;

            modify_instance_dlg.SiteName     = ListViewUtil.GetItemText(item, COLUMN_SITE);
            modify_instance_dlg.InstanceName = ListViewUtil.GetItemText(item, COLUMN_VIRTUALDIR);

            modify_instance_dlg.DataDir  = ListViewUtil.GetItemText(item, COLUMN_DATADIR);
            modify_instance_dlg.LineInfo = (LineInfo)item.Tag;

            modify_instance_dlg.VerifyInstanceName += new VerifyEventHandler(modify_instance_dlg_VerifyInstanceName);
            modify_instance_dlg.VerifyDataDir      += new VerifyEventHandler(modify_instance_dlg_VerifyDataDir);
            modify_instance_dlg.LoadXmlFileInfo    += new LoadXmlFileInfoEventHandler(modify_instance_dlg_LoadXmlFileInfo);


            modify_instance_dlg.StartPosition = FormStartPosition.CenterScreen;
            if (modify_instance_dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            ListViewUtil.ChangeItemText(item, COLUMN_SITE, modify_instance_dlg.SiteName);
            ListViewUtil.ChangeItemText(item, COLUMN_VIRTUALDIR, modify_instance_dlg.InstanceName);
            ListViewUtil.ChangeItemText(item, COLUMN_DATADIR, modify_instance_dlg.DataDir);

            modify_instance_dlg.LineInfo.Changed = true;
            item.Tag = modify_instance_dlg.LineInfo;

            ListViewUtil.SelectLine(item, true);

            this.Changed = true;

            // TODO: 最好出现一个浮动窗口显示正在创建实例
            this.Enabled = false;
            try
            {
                int nRet = CreateInstance(item,
                                          out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }
            }
            finally
            {
                this.Enabled = true;
            }
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Esempio n. 2
0
        private void button_modifyInstance_Click(object sender, EventArgs e)
        {
            string strError = "";

            HideMessageTip();

            if (this.listView_instance.SelectedItems.Count == 0)
            {
                strError = "尚未选择要修改的事项";
                goto ERROR1;
            }

            ListViewItem item = this.listView_instance.SelectedItems[0];
            this.m_currentEditItem = item;

            OneInstanceDialog modify_instance_dlg = new OneInstanceDialog();
            GuiUtil.AutoSetDefaultFont(modify_instance_dlg);
            modify_instance_dlg.Text = "修改一个实例";
            modify_instance_dlg.CreateMode = false;

            modify_instance_dlg.SiteName = ListViewUtil.GetItemText(item, COLUMN_SITE);
            modify_instance_dlg.InstanceName = ListViewUtil.GetItemText(item, COLUMN_VIRTUALDIR);

            modify_instance_dlg.DataDir = ListViewUtil.GetItemText(item, COLUMN_DATADIR);
            modify_instance_dlg.LineInfo = (LineInfo)item.Tag;

            modify_instance_dlg.VerifyInstanceName += new VerifyEventHandler(modify_instance_dlg_VerifyInstanceName);
            modify_instance_dlg.VerifyDataDir += new VerifyEventHandler(modify_instance_dlg_VerifyDataDir);
            modify_instance_dlg.LoadXmlFileInfo += new LoadXmlFileInfoEventHandler(modify_instance_dlg_LoadXmlFileInfo);


            modify_instance_dlg.StartPosition = FormStartPosition.CenterScreen;
            if (modify_instance_dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
                return;

            ListViewUtil.ChangeItemText(item, COLUMN_SITE, modify_instance_dlg.SiteName);
            ListViewUtil.ChangeItemText(item, COLUMN_VIRTUALDIR, modify_instance_dlg.InstanceName);
            ListViewUtil.ChangeItemText(item, COLUMN_DATADIR, modify_instance_dlg.DataDir);

            modify_instance_dlg.LineInfo.Changed = true;
            item.Tag = modify_instance_dlg.LineInfo;

            ListViewUtil.SelectLine(item, true);

            this.Changed = true;

            // TODO: 最好出现一个浮动窗口显示正在创建实例
            this.Enabled = false;
            try
            {
                int nRet = CreateInstance(item,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
            }
            finally
            {
                this.Enabled = true;
            }
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Esempio n. 3
0
        private void button_newInstance_Click(object sender, EventArgs e)
        {
            HideMessageTip();

            OneInstanceDialog new_instance_dlg = new OneInstanceDialog();

            GuiUtil.AutoSetDefaultFont(new_instance_dlg);
            new_instance_dlg.Text       = "创建一个新实例";
            new_instance_dlg.CreateMode = true;
#if NO
            if (this.listView_instance.Items.Count == 0)
            {
                new_instance_dlg.InstanceName = "/dp2OPAC";
            }
            else
            {
                new_instance_dlg.InstanceName = GetNewInstanceName(this.listView_instance.Items.Count + 1);
            }
#endif

            new_instance_dlg.VerifyInstanceName += new VerifyEventHandler(new_instance_dlg_VerifyInstanceName);
            new_instance_dlg.VerifyDataDir      += new VerifyEventHandler(new_instance_dlg_VerifyDataDir);
            new_instance_dlg.LoadXmlFileInfo    += new LoadXmlFileInfoEventHandler(new_instance_dlg_LoadXmlFileInfo);

            new_instance_dlg.StartPosition = FormStartPosition.CenterScreen;
            if (new_instance_dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }

            ListViewItem item = new ListViewItem();
            ListViewUtil.ChangeItemText(item, COLUMN_SITE, new_instance_dlg.SiteName);
            ListViewUtil.ChangeItemText(item, COLUMN_VIRTUALDIR, new_instance_dlg.InstanceName);
            ListViewUtil.ChangeItemText(item, COLUMN_DATADIR, new_instance_dlg.DataDir);
            this.listView_instance.Items.Add(item);

            new_instance_dlg.LineInfo.Changed = true;
            item.Tag = new_instance_dlg.LineInfo;

            ListViewUtil.SelectLine(item, true);

            this.Changed = true;

            string strError = "";

            // TODO: 最好出现一个浮动窗口显示正在创建实例
            this._floatingMessage.Text = "正在创建实例,请稍候 ...";
            this.Enabled = false;
            try
            {
                int nRet = CreateInstance(item,
                                          out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }
            }
            finally
            {
                this.Enabled = true;
                this._floatingMessage.Text = "";
            }
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Esempio n. 4
0
        private void button_newInstance_Click(object sender, EventArgs e)
        {
            HideMessageTip();

            OneInstanceDialog new_instance_dlg = new OneInstanceDialog();
            GuiUtil.AutoSetDefaultFont(new_instance_dlg);
            new_instance_dlg.Text = "创建一个新实例";
            new_instance_dlg.CreateMode = true;
#if NO
            if (this.listView_instance.Items.Count == 0)
            {
                new_instance_dlg.InstanceName = "/dp2OPAC";
            }
            else
            {
                new_instance_dlg.InstanceName = GetNewInstanceName(this.listView_instance.Items.Count + 1);
            }
#endif

            new_instance_dlg.VerifyInstanceName += new VerifyEventHandler(new_instance_dlg_VerifyInstanceName);
            new_instance_dlg.VerifyDataDir += new VerifyEventHandler(new_instance_dlg_VerifyDataDir);
            new_instance_dlg.LoadXmlFileInfo += new LoadXmlFileInfoEventHandler(new_instance_dlg_LoadXmlFileInfo);

            new_instance_dlg.StartPosition = FormStartPosition.CenterScreen;
            if (new_instance_dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.Cancel)
                return;

            ListViewItem item = new ListViewItem();
            ListViewUtil.ChangeItemText(item, COLUMN_SITE, new_instance_dlg.SiteName);
            ListViewUtil.ChangeItemText(item, COLUMN_VIRTUALDIR, new_instance_dlg.InstanceName);
            ListViewUtil.ChangeItemText(item, COLUMN_DATADIR, new_instance_dlg.DataDir);
            this.listView_instance.Items.Add(item);

            new_instance_dlg.LineInfo.Changed = true;
            item.Tag = new_instance_dlg.LineInfo;

            ListViewUtil.SelectLine(item, true);

            this.Changed = true;

            string strError = "";

            // TODO: 最好出现一个浮动窗口显示正在创建实例
            this._floatingMessage.Text = "正在创建实例,请稍候 ...";
            this.Enabled = false;
            try
            {
                int nRet = CreateInstance(item,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;
            }
            finally
            {
                this.Enabled = true;
                this._floatingMessage.Text = "";
            }
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }