void Initialize(IGuiCore guiCore, IGuiState controledGui)
 {
     StateManager        = this;
     StorageManager      = guiCore.StorageManager;
     TaskManager         = guiCore.TaskManager;
     StateFactory.Parent = TaskManager;
     ControledGui        = controledGui;
 }
        public static IGuiTask CreateTaskView(Window parent, IGuiCore core, int taskID)
        {
            ValidateCore(core);

            Task task = (Task)core.TaskManager.GetTask(taskID);
            ViewTaskDialog taskDialog = new ViewTaskDialog(parent, false);
            if(task == null)
            {
                return taskDialog;
            }

            if (task.StatePresent)
            {
                State state = (State)core.TaskManager.GetTaskState(task.StateID);
                if(state == null)
                {
                    return taskDialog;
                }

                taskDialog.StateSource = core.TaskManager.GetTaskStateSource(state);
                if(taskDialog.StateSource == null)
                {
                    return taskDialog;
                }

                taskDialog.BindState();
                taskDialog.StateID = task.StateID;
            }
            else
            {
                taskDialog.StateSource = core.TaskManager.GetInitialTaskStateSource();
                if(taskDialog.StateSource == null)
                {
                    return taskDialog;
                }

                taskDialog.BindState();
            }

            taskDialog.Title ="Edit Task";
            taskDialog.ActorSource = core.TaskManager.ActorSource;

            taskDialog.BindActor();
            if (task.ActorPresent)
            {
                taskDialog.ActorID = task.ActorID;
            }

            taskDialog.Description = task.Description;
            taskDialog.EndTime = task.EndTime;
            taskDialog.StartTime = task.StartTime;
            taskDialog.Comment = task.Comment;
            taskDialog.Priority = task.Priority;
            return taskDialog;
        }
        private static void ValidateCore(IGuiCore core)
        {
            if (core.TaskManager.ActorSource.Tables["Actor"].Rows.Count == 0)
            {
                throw new ManagementException(ExceptionType.NotAllowed,"Create actors before create tasks");
            }

            if (core.TaskManager.TaskStateSource.Tables["TaskState"].Rows.Count == 0)
            {
                throw new ManagementException(ExceptionType.NotAllowed,"Create states before create tasks");
            }
        }
        public static IGuiTask CreateTaskView(Window parent, IGuiCore core)
        {
            ValidateCore(core);

            ViewTaskDialog taskDialog = new ViewTaskDialog(parent, true);
            taskDialog.Title ="Create Task";
            taskDialog.ActorSource = core.TaskManager.ActorSource;
            taskDialog.StateSource = core.TaskManager.GetInitialTaskStateSource();
            if(taskDialog.StateSource == null)
            {
                return taskDialog;
            }

            taskDialog.BindActor();
            taskDialog.BindState();

            return taskDialog;
        }
Example #5
0
        private void Initialize(Window parent, IGuiCore guiCore)
        {
            stateCore = new StateCore(guiCore, this);
            Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ViewStateDialog.glade");

            Glade.XML glade = new Glade.XML(stream, "EditStatesDialog", null);
            stream.Close();
            glade.Autoconnect(this);
            thisDialog              = ((Dialog)(glade.GetWidget("EditStatesDialog")));
            thisDialog.Modal        = true;
            thisDialog.TransientFor = parent;
            thisDialog.SetDefaultSize(800, 600);
            thisDialog.WindowPosition = WindowPosition.CenterAlways;

            btnApply.Clicked += new EventHandler(OnApply);

            //btnSearch.Clicked += new EventHandler(OnStateSearch);
            btnCreateState.Clicked += new EventHandler(OnCreateState);
            btnEditState.Clicked   += new EventHandler(OnEditState);
            btnDeleteState.Clicked += new EventHandler(OnDeleteState);

            btnCreateConnection.Clicked += new EventHandler(OnCreateConnection);
            btnEditConnection.Clicked   += new EventHandler(OnEditConnection);
            btnDeleteConnection.Clicked += new EventHandler(OnDeleteConnection);

            TaskStateStore = new TreeStore(typeof(int), typeof(string), typeof(int));

            tvState.HeadersVisible = true;
            tvState.AppendColumn("ID", new CellRendererText(), "text", 1);
            tvState.AppendColumn("Name", new CellRendererText(), "text", 1);
            tvState.GetColumn(0).Visible = false;

            tvStateConnection.HeadersVisible = true;
            tvStateConnection.AppendColumn("ID", new CellRendererText(), "text", 1);
            tvStateConnection.AppendColumn("Name", new CellRendererText(), "text", 1);
            tvStateConnection.GetColumn(0).Visible = false;

            Source = stateCore.TaskManager.TaskStateSource;

            BindStateSearchDictionary();
            BindStates();

            //BindStateSearchCompletion();
        }
        public static ViewTaskAssign CreateTaskAssign(Window parent, IGuiCore core, int taskID)
        {
            ValidateCore(core);
            Task task = (Task)core.TaskManager.GetTask(taskID);
            ViewTaskAssign assignDialog = new ViewTaskAssign(parent);
            if(task == null)
            {
                return assignDialog;
            }

            assignDialog.ActorSource = core.TaskManager.ActorSource;
            assignDialog.BindActor();
            if (task.ActorPresent)
            {
                assignDialog.ActorID = task.ActorID;
            }

            assignDialog.Title = "Assign Task";
            assignDialog.AssignAction = string.Format("Assign task {0} to Actor", task.Id);

            return  assignDialog;
        }
 public StateCore(IGuiCore guiCore, IGuiState controledGui)
 {
     Initialize(guiCore, controledGui);
     autosave = bool.TryParse(ConfigurationManager.AppSettings["autosave"], out autosave) || autosave;
 }
Example #8
0
                #pragma warning restore 0169
                #pragma warning restore 0649

        public ViewStateDialog(Window parent, IGuiCore guiCore)
        {
            Initialize(parent, guiCore);
        }
 public static ViewStateDialog CreateStateView(Window parent, IGuiCore guiCore)
 {
     ViewStateDialog stateView = new ViewStateDialog(parent,guiCore);
     stateView.Title = "Edit States";
     return stateView;
 }