public void AssignTask(int taskID)
        {
            ViewTaskAssign assignView = null;

            try
            {
                assignView = GuiFactory.CreateTaskAssign(window, (IGuiCore)this, taskID);
            }
            catch (ManagementException ex)
            {
                IGuiMessageDialog dialog = MessageFactory.CreateErrorDialog(ex, window);
                dialog.Title = "Task Assign";
                dialog.ShowDialog();
                return;
            }

            if (assignView.ShowDialog() == (int)Gtk.ResponseType.Ok)
            {
                Task task = (Task)TaskManager.GetTask(taskID);
                if (task == null)
                {
                    return;
                }
                task.ActorID = assignView.ActorID;
                task.Save();
                Tracker.TaskSource = TaskManager.TaskSource;
                Tracker.BindTask();
                if (autosave)
                {
                    SaveProject();
                }
            }
        }
Beispiel #2
0
        private void OnEditState(object sender, EventArgs args)
        {
            TreeModel model;
            TreeIter  iter;

            ((TreeSelection)tvState.Selection).GetSelected(out model, out iter);
            int  stateId       = -1;
            bool stateRequired = true;

            try
            {
                object res = model.GetValue(iter, 0);
                if (res != null)
                {
                    stateId = (int)res;
                }
            }
            catch (Exception ex)
            {
                stateRequired = false;
                IGuiMessageDialog dialog = MessageFactory.CreateErrorDialog(ex, thisDialog);
                dialog.Title = "State Edit";
                dialog.ShowDialog();
            }

            if (stateRequired && stateId != -1)
            {
                stateCore.EditTaskState(stateId);
            }
        }
        public void CreateTask()
        {
            IGuiTask taskView = null;

            try
            {
                taskView = GuiFactory.CreateTaskView(window, (IGuiCore)this);
                if (taskView == null)
                {
                    return;
                }
            }
            catch (ManagementException ex)
            {
                IGuiMessageDialog dialog = MessageFactory.CreateErrorDialog(ex, window);
                dialog.Title = "Create Task";
                dialog.ShowDialog();
                return;
            }

            Tracker.ActorSource = TaskManager.ActorSource;
            Tracker.BindTask();
            if (taskView.ShowDialog() == (int)Gtk.ResponseType.Ok)
            {
                Task newTask = (Task)TaskManager.CreateTask();
                if (newTask == null)
                {
                    return;
                }
                if (taskView.ActorPresent)
                {
                    newTask.ActorID = taskView.ActorID;
                }
                else
                {
                    newTask.ActorPresent = false;
                }
                newTask.Description = taskView.Description;
                newTask.EndTime     = taskView.EndTime;
                newTask.StartTime   = taskView.StartTime;
                newTask.StateID     = taskView.StateID;
                newTask.Priority    = taskView.Priority;

                newTask.Save();

                Tracker.TaskSource = TaskManager.TaskSource;
                Tracker.BindTask();
                if (autosave)
                {
                    SaveProject();
                }
            }
        }
        public void UpdateTaskState(int taskID)
        {
            IGuiTask taskView = null;

            try
            {
                taskView = GuiFactory.CreateTaskView(window, (IGuiCore)this, taskID);
            }
            catch (ManagementException ex)
            {
                IGuiMessageDialog dialog = MessageFactory.CreateErrorDialog(ex, window);
                dialog.Title = "Change Task State";
                dialog.ShowDialog();
                return;
            }

            if (taskView.ShowDialog() == (int)Gtk.ResponseType.Ok)
            {
                Task task = (Task)TaskManager.GetTask(taskID);
                if (task == null)
                {
                    return;
                }
                if (taskView.ActorPresent)
                {
                    task.ActorID = taskView.ActorID;
                }
                task.Description = taskView.Description;
                task.EndTime     = taskView.EndTime;
                task.StartTime   = taskView.StartTime;
                task.StateID     = taskView.StateID;
                task.Priority    = taskView.Priority;
                task.Save();
                Tracker.TaskSource = TaskManager.TaskSource;
                Tracker.BindTask();
                if (autosave)
                {
                    SaveProject();
                }
            }
        }
Beispiel #5
0
        static void ShowError(Exception ex)
        {
            var silentexceptions = ConfigurationManager.AppSettings["silentexceptions"];

            if (silentexceptions != null && ex != null && silentexceptions.Split(';').Any(s => ex.ToString().IndexOf(s) >= 0))
            {
                return;
            }

            Console.WriteLine("--------------------------Appication Exception-----------------");
            if (ex == null)
            {
                Console.WriteLine("unknown");
                return;
            }

            Console.WriteLine(ex.ToString());

            IGuiMessageDialog dialog = MessageFactory.CreateErrorDialog(ex, mainForm);

            dialog.ShowDialog();
        }