Exemplo n.º 1
0
        /// <summary>
        /// 查找(定位)
        /// </summary>
        protected virtual void Find()
        {
            try
            {
                if (this.mDataFindFieldName == "")
                {
                    return;
                }

                this.CheckClientBLDataObject();

                if (!this.CanLeave())
                {
                    return;
                }

                string strCode = MyInputBox.Show("查找定位功能用于定位到相关数据行,请输入代码[" + this.mDataFindFieldName + "]:", "");
                if (strCode != string.Empty)
                {
                    int pos = this.bindingSource1.Find(this.mDataFindFieldName, strCode);
                    if (pos >= 0)
                    {
                        this.bindingSource1.Position = pos;
                    }
                    else
                    {
                        throw new Exception("未找到指定的资料。");
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            MyTodoItem td;

            if (lastFocusControl is MyTodoItem)
            {
                td = lastFocusControl as MyTodoItem;
            }
            else if (lastFocusControl is MyAutoSizeTextbox)
            {
                td = lastFocusControl.Parent as MyTodoItem;
            }
            else
            {
                return;
            }

            FlowLayoutPanel container = td.Parent as FlowLayoutPanel;
            int             index     = container.Controls.GetChildIndex(td);

            container.Controls.Remove(td);
            MyInputBox input = new MyInputBox(container, td);

            container.Controls.Add(input);
            container.Controls.SetChildIndex(input, index);
            input.Todocont.Focus();
        }
Exemplo n.º 3
0
 private void AddNewItemBtn_Click(object sender, EventArgs e)
 {
     if (Data.nowDisplayList != null)
     {
         MyContentPanel panel = Data.nowDisplayList;
         //panel.Todos.AddNewItem();
         MyTodoItem newItem = new MyTodoItem();
         MyInputBox input   = new MyInputBox(panel.Todos.TodoList, newItem);
         panel.Todos.TodoList.Controls.Add(input);
         input.Todocont.Focus();
     }
 }
Exemplo n.º 4
0
        private void EditBtn_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem delete = sender as ToolStripMenuItem;
            ContextMenuStrip  menu   = delete.Owner as ContextMenuStrip;
            MyTodoItem        td     = menu.SourceControl as MyTodoItem;

            FlowLayoutPanel container = td.Parent as FlowLayoutPanel;
            int             index     = container.Controls.GetChildIndex(td);

            container.Controls.Remove(td);
            MyInputBox input = new MyInputBox(container, td);

            container.Controls.Add(input);
            container.Controls.SetChildIndex(input, index);
            input.Todocont.Focus();
        }
Exemplo n.º 5
0
        public void InitiateExecution(params object[] obj)
        {
            if (!CanBeExecutedOn(obj))
            {
                throw new InvalidOperationException("Cannot be executed!");
            }

            var tran = _transactionProvider.GetCurrentTransaction();

            tran.CaptureMacroState("CommandAddMission");

            string nameForMission = MyInputBox.GetText("Enter mission name", "A mission");
            var    mission        = new Mission();

            //var insert = new McrInsertElementToCollection(_engine.Missions, mission);
            tran.Helper.AddItem(_engine.Missions, mission);
            tran.Helper.SetValue(mission, m => m.Name, nameForMission);

            tran.Commit();
        }