Example #1
0
        // 询问无法匹配的源路径如何处理
        // return:
        //      -1  出错
        //		0	cancel全部处理
        //		1	已经选择处理办法
        public static int AskNotMatchOriginBox(
            IWin32Window owner,
            ApplicationInfo ap,
            ServerCollection Servers,
            RmsChannelCollection Channels,
            string strComment,
            string strSelectedLongPath,
            string strOrigin,
            DbNameMap map)
        {
            DbNameMapItemDlg dlg = new DbNameMapItemDlg();

            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Servers   = Servers;
            dlg.Channels  = Channels;
            dlg.Comment   = strComment;
            dlg.AskMode   = AskMode.AskNotMatchOrigin;
            dlg.Origin    = strOrigin;
            dlg.Target    = strSelectedLongPath;
            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);
        }
Example #2
0
        // 询问无法匹配的源路径如何处理
        // return:
        //      -1  出错
        //		0	cancel全部处理
        //		1	已经选择处理办法
        public static int AskNotMatchOriginBox(
            IWin32Window owner,
            ApplicationInfo ap,
            ServerCollection Servers,
            RmsChannelCollection Channels,
            string strComment,
            string strSelectedLongPath,
            string strOrigin,
            DbNameMap map)
        {
            DbNameMapItemDlg dlg = new DbNameMapItemDlg();
            dlg.Font = GuiUtil.GetDefaultFont();

            dlg.Servers = Servers;
            dlg.Channels = Channels;
            dlg.Comment = strComment;
            dlg.AskMode = AskMode.AskNotMatchOrigin;
            dlg.Origin = strOrigin;
            dlg.Target = strSelectedLongPath;
            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;
        }