Esempio n. 1
0
 protected internal override void ButtonClick(string tag) {
     switch(tag) {
         case TagResources.ContactList:
             UpdateMainView(gridView1);
             ClearSortingAndGrouping();
             break;
         case TagResources.ContactAlphabetical:
             UpdateMainView(gridView1);
             ClearSortingAndGrouping();
             colName.Group();
             break;
         case TagResources.ContactByState:
             UpdateMainView(gridView1);
             ClearSortingAndGrouping();
             colState.Group();
             colCity.SortOrder = DevExpress.Data.ColumnSortOrder.Ascending;
             break;
         case TagResources.ContactCard:
             UpdateMainView(layoutView1);
             break;
         case TagResources.FlipLayout:
             layoutControl1.Root.FlipLayout();
             break;
         case TagResources.ContactDelete:
             if(CurrentContact == null) return;
             int index = gridView1.FocusedRowHandle;
             gridControl1.MainView.BeginDataUpdate();
             try {
                 DataHelper.Contacts.Remove(CurrentContact);
             } finally {
                 gridControl1.MainView.EndDataUpdate();
             }
             if(index > gridView1.DataRowCount - 1) index--;
             gridView1.FocusedRowHandle = index;
             ShowInfo(gridView1);
             break;
         case TagResources.ContactNew:
             Contact contact = new Contact();
             if(EditContact(contact) == DialogResult.OK) {
                 gridControl1.MainView.BeginDataUpdate();
                 try {
                     DataHelper.Contacts.Add(contact);
                 } finally {
                     gridControl1.MainView.EndDataUpdate();
                 }
                 ColumnView view = gridControl1.MainView as ColumnView;
                 if(view != null) {
                     GridHelper.GridViewFocusObject(view, contact);
                     ShowInfo(view);
                 }
             }
             break;
         case TagResources.ContactEdit:
             EditContact(CurrentContact);
             break;
     }
     UpdateCurrentContact();
     UpdateInfo();
 }
Esempio n. 2
0
        internal override void FocusObject(object obj)
        {
            ColumnView view = gridControl1.MainView as ColumnView;

            if (view != null)
            {
                GridHelper.GridViewFocusObject(view, obj);
            }
        }
Esempio n. 3
0
        void DoEditTaskButtonClick(string tag)
        {
            switch (tag)
            {
            case TagResources.TaskDelete:
                if (CurrentTask == null)
                {
                    return;
                }
                int index = gridView1.FocusedRowHandle;
                gridView1.BeginDataUpdate();
                try {
                    foreach (List <Task> list in tasks.Values)
                    {
                        list.Remove(CurrentTask);
                    }
                } finally {
                    gridView1.EndDataUpdate();
                }
                if (index > gridView1.DataRowCount - 1)
                {
                    index--;
                }
                gridView1.FocusedRowHandle = index;
                ShowInfo(gridView1);
                break;

            case TagResources.TaskNew:
                if (CurrentKey != null)
                {
                    Task task = new Task(Properties.Resources.NewTaskName, TaskCategory.Office);
                    task.AssignTo = CurrentKey.Contact;
                    if (EditTask(task) == DialogResult.OK)
                    {
                        gridControl1.MainView.BeginDataUpdate();
                        try {
                            ((List <Task>)tasks[CurrentKey]).Add(task);
                        } finally {
                            gridControl1.MainView.EndDataUpdate();
                        }
                        ColumnView view = gridControl1.MainView as ColumnView;
                        if (view != null)
                        {
                            GridHelper.GridViewFocusObject(view, task);
                            ShowInfo(view);
                        }
                    }
                }
                break;

            case TagResources.TaskEdit:
                EditTask(CurrentTask);
                break;
            }
        }