Exemplo n.º 1
0
 public VdWndShortcutEditor(string content, string code, WndShortcutEditor wnd) : base(wnd)
 {
     this.Content = (content ?? "");
     this.Code    = (code ?? "");
     this._wnd    = wnd;
     SetBinding("Content", wnd.tboxContent, () => {
         return((!string.IsNullOrEmpty(this.Content) || this._wnd.imgMain.Tag != null) ? null : "必填!");
     });
     SetBinding("Code", wnd.tboxCode, () => {
         string err = null;
         var c      = _oriCode.Trim();
         if (!string.IsNullOrEmpty(c))
         {
             if (char.IsDigit(c[0]))
             {
                 err = "快捷编码的“第一个字”不能为数字";
             }
             else if (char.IsDigit(c.ToCharArray()[c.Length - 1]))
             {
                 err = "快捷编码的“最后一个字”不能为数字";
             }
         }
         return(err);
     });
 }
Exemplo n.º 2
0
        public static void CreateNew(string parentId, string dbAccount, string seller, Window ownnerWnd, Action <TreeNode> callback)
        {
            var wnd = new WndShortcutEditor(null, null, null);

            wnd.FirstShow(seller, ownnerWnd, () =>
            {
                if (wnd._isSubmit)
                {
                    var et       = EntityHelper.Create <ShortcutEntity>(dbAccount);
                    et.ParentId  = parentId;
                    et.Title     = wnd.tboxQuestion.Text.Trim();
                    et.Text      = wnd._data.Content;
                    et.Code      = wnd._data.Code;
                    et.ImageName = wnd.imgMain.Tag == null ? "" : wnd.imgMain.Tag.ToString();
                    callback(et);
                }
            }, false);
        }
Exemplo n.º 3
0
        public static void Edit(ShortcutEntity pre, string seller, string dbAccount, Window ownnerWnd, Action <TreeNode> callback)
        {
            var wnd = new WndShortcutEditor(pre.Title, pre.Text, pre.Code, pre.ImageName);

            wnd.FirstShow(seller, ownnerWnd, () =>
            {
                if (wnd._isSubmit)
                {
                    var et       = pre.Clone <ShortcutEntity>(false);
                    et.Title     = wnd.tboxQuestion.Text.Trim();
                    et.Text      = wnd._data.Content;
                    et.Code      = wnd._data.Code;
                    et.ImageName = wnd.imgMain.Tag == null ? "" : wnd.imgMain.Tag.ToString();

                    EntityHelper.SetModifyTick(et);
                    callback(et);
                }
            }, false);
        }
Exemplo n.º 4
0
 public override void Edit(TreeNode pre, Window wnd, Action <TreeNode> callback)
 {
     WndShortcutEditor.Edit(pre as ShortcutEntity, Seller, DbAccount, wnd, callback);
 }
Exemplo n.º 5
0
 public override void Create(TreeNode pn, Window wnd, Action <TreeNode> callback, object obj = null)
 {
     WndShortcutEditor.CreateNew(pn.EntityId, DbAccount, Seller, wnd, callback);
 }