Exemple #1
0
        void menu_modify(object sender, EventArgs e)
        {
            if (this.listView_map.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择要修改的事项");
                return;
            }

            DbNameMapItemDlg dlg = new DbNameMapItemDlg();

            dlg.Font        = GuiUtil.GetDefaultFont();
            dlg.SearchPanel = this.SearchPanel;
            dlg.Origin      = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[0].Text);
            dlg.Target      = ResPath.GetRegularRecordPath(this.listView_map.SelectedItems[0].SubItems[1].Text);
            dlg.WriteMode   = this.listView_map.SelectedItems[0].SubItems[2].Text;

            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            this.listView_map.SelectedItems[0].SubItems[0].Text = ResPath.GetReverseRecordPath(dlg.Origin);
            this.listView_map.SelectedItems[0].SubItems[1].Text = ResPath.GetReverseRecordPath(dlg.Target);
            this.listView_map.SelectedItems[0].SubItems[2].Text = ResPath.GetReverseRecordPath(dlg.WriteMode);
        }
Exemple #2
0
        // 询问无法匹配的源路径如何处理
        // return:
        //      -1  出错
        //		0	cancel全部处理
        //		1	已经选择处理办法
        public static int AskNotMatchOriginBox(
            IWin32Window owner,
            ApplicationInfo ap,
            string strComment,
            SearchPanel searchpanel,
            string strOrigin,
            DbNameMap map)
        {
            DbNameMapItemDlg dlg = new DbNameMapItemDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Comment     = strComment;
            dlg.AskMode     = AskMode.AskNotMatchOrigin;
            dlg.SearchPanel = searchpanel;
            dlg.Origin      = strOrigin;
            dlg.Target      = "";
            dlg.WriteMode   = "append";

            dlg.Text = "请指定映射关系";

            if (ap != null)
            {
                ap.LinkFormState(dlg, "AskNotMatchOriginBox_state");
            }
            dlg.ShowDialog(owner);
            if (ap != null)
            {
                ap.UnlinkFormState(dlg);
            }

            if (dlg.DialogResult != DialogResult.OK)
            {
                return(0);       // cancel
            }
            string strError = "";

            if (map.NewItem(dlg.Origin, dlg.Target,
                            dlg.WriteMode,
                            0, // 插入最前面
                            out strError) == null)
            {
                MessageBox.Show(owner, strError);
                return(-1);
            }

            return(1);
        }
Exemple #3
0
        void menu_new(object sender, EventArgs e)
        {
            DbNameMapItemDlg dlg = new DbNameMapItemDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.SearchPanel = this.SearchPanel;
            dlg.ShowDialog(this);

            if (dlg.DialogResult != DialogResult.OK)
            {
                return;
            }

            ListViewItem item = new ListViewItem(ResPath.GetReverseRecordPath(dlg.Origin), 0);

            item.SubItems.Add(ResPath.GetReverseRecordPath(dlg.Target));
            item.SubItems.Add(dlg.WriteMode);

            this.listView_map.Items.Add(item);
        }