Ejemplo n.º 1
0
Archivo: DBI.cs Proyecto: 15831944/Apq
        private void treeListView1_AfterLabelEdit(object sender, TreeListViewLabelEditEventArgs e)
        {
            ColumnHeader      ch  = e.Item.ListView.Columns[e.ColumnIndex];
            DataColumnMapping dcm = tlvHelper.TableMapping.ColumnMappings[ch.Text];

            long DBIID = Apq.Convert.ChangeType <long>(e.Item.SubItems[e.Item.ListView.Columns.Count].Text);

            DataRow[] drs = GlobalObject.Lookup.DBI.Select("DBIID = " + DBIID);
            if (drs.Length > 0)
            {
                drs[0][dcm.DataSetColumn] = e.Label;
            }
        }
Ejemplo n.º 2
0
        private void treeView_AfterLabelEdit(object sender, TreeListViewLabelEditEventArgs e)
        {
            Task task = Tasks.FindById(Convert.ToInt32(e.Item.Tag));

            if (task != null)
            {
                if (this.treeView.Columns[e.ColumnIndex] == this.tasksColumnHeader)
                {
                    if (e.Label == null || e.Label == String.Empty)
                    {
                        e.Cancel = true;
                        return;
                    }
                    task.Description = e.Label;
                }
                if (this.priorityColumnHeader == this.treeView.Columns[e.ColumnIndex])
                {
                    int priority;
                    if (e.Label == null || e.Label == String.Empty || e.Label == "(null)")
                    {
                        task.Priority = 0;
                    }
                    else if (int.TryParse(e.Label, out priority) && priority >= 0 && priority <= 9)
                    {
                        task.Priority = priority;
                    }
                    else
                    {
                        e.Cancel = true;
                        return;
                    }
                }
                try
                {
                    Tasks.UpdateTask(task);
                }
                catch (ApplicationException aex)
                {
                    MessageBox.Show(aex.Message, this.ParentForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                finally
                {
                    e.Cancel = true; //always cancel, the event Tasks.TaskChanged will change the value.
                }
            }
            else
            {
                MessageBox.Show("This task has been deleted.", this.ParentForm.Text, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
 private void treeListView1_AfterLabelEdit(object sender, TreeListViewLabelEditEventArgs e)
 {
     MessageBox.Show(string.Format("编辑之前的值:{0},编辑之后的值:{1}",e.LabelOld,e.Label));
 }
Ejemplo n.º 4
0
        private void treeView_AfterLabelEdit(object sender, TreeListViewLabelEditEventArgs e)
        {
            Task task = Tasks.FindById(Convert.ToInt32(e.Item.Tag));

            if (task != null)
            {
                if(this.treeView.Columns[e.ColumnIndex] == this.tasksColumnHeader)
                {
                    if (e.Label == null || e.Label == String.Empty)
                    {
                        e.Cancel = true;
                        return;
                    }
                    task.Description = e.Label;
                }
                if (this.priorityColumnHeader == this.treeView.Columns[e.ColumnIndex])
                {
                    int priority;
                    if (e.Label == null || e.Label == String.Empty || e.Label == "(null)")
                    {
                        task.Priority = 0;
                    }
                    else if (int.TryParse(e.Label, out priority) && priority >= 0 && priority<=9)
                    {
                        task.Priority = priority;
                    }
                    else
                    {
                        e.Cancel = true;
                        return;
                    }
                }
                try
                {
                    Tasks.UpdateTask(task);
                }
                catch (ApplicationException aex)
                {
                    MessageBox.Show(aex.Message, this.ParentForm.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                finally
                {
                    e.Cancel = true; //always cancel, the event Tasks.TaskChanged will change the value.
                }
            }
            else
            {
                MessageBox.Show("This task has been deleted.", this.ParentForm.Text, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 5
0
        internal void ExitEdit(bool Cancel, string Text)
        {
            if(!InEdit || EditedItem.Item == null) return;
                // Mouse position
                Point pos = EditedItem.Item != null ?
                    EditedItem.Item.GetBounds(TreeListViewItemBoundsPortion.Icon).Location :
                    new Point(0, 0);
                pos.Offset(1,1);
                EditItemInformations editedItem = EditedItem;

                Message m = Message.Create(Handle, (int) APIsEnums.WindowMessages.LBUTTONDOWN, (IntPtr)1, (IntPtr) ((pos.Y << 16) + pos.X));
                _skipMouseDownEvent = true;
                base.WndProc(ref m);
                _skipMouseDownEvent = false;
                if(!Cancel)
                {
                    TreeListViewLabelEditEventArgs e = new TreeListViewLabelEditEventArgs(editedItem.Item, editedItem.ColumnIndex, Text);
                    OnAfterLabelEdit(e);
                    if(!e.Cancel)
                        editedItem.Item.SubItems[editedItem.ColumnIndex].Text = Text;
                }
                _inedit = false;
                _editeditem = new EditItemInformations(null, 0, "");
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Raises the AfterLabelEdit event.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnAfterLabelEdit(TreeListViewLabelEditEventArgs e)
 {
     if(AfterLabelEdit != null) AfterLabelEdit(this, e);
 }