Ejemplo n.º 1
0
        public void CreateToDoList(string filepath)
        {
            var box = new SPSBox();

            box.FilePath = filepath;
            dispatcher.SendServiceCode(SPSServiceCode.CreateToDoList, this, box);
        }
        public void DeleteTask(SPSBox box)
        {
            var q = new DeleteSPSTask(box);

            box.SPSTask.Id = box.GetGuidByIndex(box.index);
            q.Execute();
        }
        private void Search(SPSBox box)
        {
            switch (box.Search)
            {
            case SPSSearchBy.Status:
                var s = new SPSSearchByDateDue();
                s.Search(box);
                break;

            case SPSSearchBy.Priority:
                var p = new SPSSearchByPriority();
                p.Search(box);
                break;

            case SPSSearchBy.Tag:
                var t = new SPSSearchByTag();
                t.Search(box);
                break;

            case SPSSearchBy.Info:
                var i = new SPSSearchByInfo();
                i.Search(box);
                break;

            case SPSSearchBy.DueDate:
                var d = new SPSSearchByDateDue();
                d.Search(box);
                break;

            default:
                break;
            }
        }
        private void btnCreateNewList_Click(object sender, EventArgs e)
        {
            var box = new SPSBox();

            box.FilePath = "test2.sps";
            Dispatcher.SendServiceCode(SPSServiceCode.CreateToDoList, Dispatcher.GetView(), box);
            listView.Clear();
            box.Dispose();
        }
        public override void Activity(SPSServiceCode code, SPSBox box)
        {
            if (box == null)
            {
                throw new ArgumentNullException(paramName: nameof(box));
            }

            switch (code)
            {
            case SPSServiceCode.Update:
                Update(box);
                break;

            case SPSServiceCode.DeleteTask:
                DeleteTask(box); db.Write();
                break;

            case SPSServiceCode.Change:
                Change(box); db.Write();
                break;

            case SPSServiceCode.CreateToDoList:
                CreateToDoList(box.FilePath);
                break;

            case SPSServiceCode.CreateToDoTask:
                CreateToDoTask(box); db.Write();
                break;

            case SPSServiceCode.SetPriority:
                SetPriority(box); db.Write();
                break;

            case SPSServiceCode.SetDueDate:
                SetDueDate(box); db.Write();
                break;

            case SPSServiceCode.Fill:
                Fill(box);
                break;

            case SPSServiceCode.SetTag:
                SetTag(box); db.Write();
                break;

            case SPSServiceCode.SetInfo:
                SetInfo(box); db.Write();
                break;

            case SPSServiceCode.Search:
                Search(box);
                break;

            default:
                break;
            }
        }
        public Main(SPSDispatcher dispatcher)
        {
            Dispatcher = dispatcher;

            InitializeComponent();
            var box = new SPSBox();

            box.ListView = listView;
            Dispatcher.SendServiceCode(SPSServiceCode.Update, dispatcher.GetView(), box);
            box.Dispose();
        }
 private void btnDeleteTask_Click(object sender, EventArgs e)
 {
     if (listView.SelectedItems.Count > 0)
     {
         var index = listView.Items.IndexOf(listView.SelectedItems[0]);
         var box   = new SPSBox();
         box.index = index;
         Dispatcher.SendServiceCode(SPSServiceCode.DeleteTask, Dispatcher.GetView(), box);
         box.ListView = listView;
         Dispatcher.SendServiceCode(SPSServiceCode.Update, Dispatcher.GetView(), box);
         box.Dispose();
     }
 }
        public void SendServiceCode(SPSServiceCode code, SPSmvc smvc, SPSBox box)
        {
            box.Tasks = null;
            controller.SetContext(ref box.Tasks);

            if (smvc is SPSFacade)
            {
                view.Activity(code, box);
            }
            else if (smvc is SPSView)
            {
                controller.Activity(code, box);
            }
        }
        private void btnLoadFromfile_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.InitialDirectory = "c:\\";
                openFileDialog.Filter           = "sps files (*.sps)|*.sps|All files (*.*)|*.*";
                openFileDialog.FilterIndex      = 2;
                openFileDialog.RestoreDirectory = true;

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    SPSBox box = new SPSBox();
                    box.FilePath = openFileDialog.FileName;
                    Dispatcher.SendServiceCode(SPSServiceCode.CreateToDoList, Dispatcher.GetView(), box);
                    box.ListView = listView;
                    Dispatcher.SendServiceCode(SPSServiceCode.Update, Dispatcher.GetController(), box);
                    box.Dispose();
                }
            }
        }
        public void SetDueDate(SPSBox box)
        {
            var q = new ChangeSPSTaskDueDate(box);

            q.Execute();
        }
Ejemplo n.º 11
0
 public void SetInfo(SPSBox box)
 {
     dispatcher.SendServiceCode(SPSServiceCode.SetInfo, this, box);
 }
        public void SetTag(SPSBox box)
        {
            var q = new ChangeSPSTaskTag(box);

            q.Execute();
        }
Ejemplo n.º 13
0
 public void Update(SPSBox box)
 {
     dispatcher.SendServiceCode(SPSServiceCode.Update, this, box);
 }
Ejemplo n.º 14
0
 public override void Activity(SPSServiceCode code, SPSBox box)
 {
     throw new NotImplementedException();
 }
        public void Update(SPSBox box)
        {
            var q = new UpdateListTasks(box);

            q.Execute();
        }
Ejemplo n.º 16
0
 public void SetPriority(SPSBox box)
 {
     dispatcher.SendServiceCode(SPSServiceCode.SetPriority, this, box);
 }
Ejemplo n.º 17
0
 public void CreateToDoTask(SPSBox box)
 {
     dispatcher.SendServiceCode(SPSServiceCode.CreateToDoTask, this, box);
 }
Ejemplo n.º 18
0
 public void DeleteTask(SPSBox box)
 {
     dispatcher.SendServiceCode(SPSServiceCode.DeleteTask, this, box);
 }
Ejemplo n.º 19
0
 public void Change(SPSBox box)
 {
     dispatcher.SendServiceCode(SPSServiceCode.Change, this, box);
 }
        public void SetInfo(SPSBox box)
        {
            var q = new ChangeSPSTaskInfo(box);

            q.Execute();
        }
        public void CreateToDoTask(SPSBox box)
        {
            var q = new CreateSPSTask(box);

            q.Execute();
        }
Ejemplo n.º 22
0
 public void SendServiceCode(SPSServiceCode code, SPSBox box)
 {
     dispatcher.SendServiceCode(code, this, box);
 }
        public void Change(SPSBox box)
        {
            var q = new ChangeSPSTask(box);

            q.Execute();
        }
        public void SetPriority(SPSBox box)
        {
            var q = new ChangeSPSTaskPriority(box);

            q.Execute();
        }
Ejemplo n.º 25
0
 public void SetDueDate(SPSBox box)
 {
     dispatcher.SendServiceCode(SPSServiceCode.SetDueDate, this, box);
 }
Ejemplo n.º 26
0
 public abstract void Activity(SPSServiceCode code, SPSBox box);
 private void Fill(SPSBox box)
 {
     box.SPSTask = box.GetCopyByIndex(box.index);
 }