Ejemplo n.º 1
0
        private void SetReturnType(EntryExt entry)
        {
            ReturnType type = entry.ReturnType;

            switch (type)
            {
            case ReturnType.Go:
                Control.ImeOptions = ImeAction.Go;
                Control.SetImeActionLabel("Go", ImeAction.Go);
                break;

            case ReturnType.Next:
                Control.ImeOptions = ImeAction.Next;
                Control.SetImeActionLabel("Next", ImeAction.Next);
                break;

            case ReturnType.Send:
                Control.ImeOptions = ImeAction.Send;
                Control.SetImeActionLabel("Send", ImeAction.Send);
                break;

            case ReturnType.Search:
                Control.ImeOptions = ImeAction.Search;
                Control.SetImeActionLabel("Search", ImeAction.Search);
                break;

            default:
                Control.ImeOptions = ImeAction.Done;
                Control.SetImeActionLabel("Done", ImeAction.Done);
                break;
            }
        }
Ejemplo n.º 2
0
        protected override void OnElementChanged(ElementChangedEventArgs <Entry> e)
        {
            base.OnElementChanged(e);

            EntryExt entry = (EntryExt)this.Element;

            if (this.Control != null)
            {
                if (entry != null)
                {
                    SetReturnType(entry);

                    // Editor Action is called when the return button is pressed
                    Control.EditorAction += (object sender, TextView.EditorActionEventArgs args) =>
                    {
                        if (entry.ReturnType != ReturnType.Next)
                        {
                            entry.Unfocus();
                        }

                        // Call all the methods attached to base_entry event handler Completed
                        entry.InvokeCompleted();
                    };
                }
            }
        }
Ejemplo n.º 3
0
 public virtual ActionResult Edit(long?id)
 {
     if (id != null)
     {
         //修改
         Tuple <Wiki, WikiVersion> d = Entry.Get(id.Value);
         Wiki entry = d.Item1;
         if ((entry.Status == (int)WikiStatus.Common || HasManageRight() ||
              new[] { 0, WebUser.UserId }.Contains(entry.CreatorId)))
         {
             ViewData["exists"] = true;
             ViewData["entry"]  = entry;
             ViewData["id"]     = entry.Id;
             WikiVersion ev = d.Item2;
             if (ev == null)
             {
                 ev = new WikiVersion();
             }
             ViewData["entryversion"] = ev; //.Url;
             EntryExt ee = JsonAdapter.Deserialize <EntryExt>(ev.Ext) ?? new EntryExt();
             ViewData["tags"] = string.Join(",", ee.Tags.ToNotNull().ToArray());
             Title            = "编辑词条:" + entry.Url;
         }
         else
         {
             return(View("Wait"));
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(Request.QueryString["url"]))
         {
             ViewData["entry.Url"] = Request.QueryString["url"];
         }
         ViewData["entryversion.reason"] = "创建词条";
         Title = "创建词条";
     }
     return(View());
 }