Exemplo n.º 1
0
 private void ActionsWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     if (CheckAtiva?.Path == e.FullPath)
     {
         CheckAtiva         = ChecklistExtensions.ReadChecklist(e.FullPath);
         lbCheck.DataSource = CheckAtiva.GetList();
     }
 }
Exemplo n.º 2
0
        private void MoveStrip_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem _sender = sender as ToolStripMenuItem;

            Classes.Checklist clTarget = ChecklistExtensions.FindCheckList(_sender.Text);
            object            item     = lbCheck.SelectedItem;

            CheckAtiva.MoverItem(item, clTarget);
        }
Exemplo n.º 3
0
        public bool MoverItem(object item, Checklist clTarget)
        {
            bool success = true, cAcess = clTarget.Accessible;

            clTarget.Accessible = true;
            success            &= clTarget.AdicionarItem(item as Item);
            clTarget.Accessible = false;
            success            &= RemoverItem(item);
            return(success);
        }
Exemplo n.º 4
0
        public Item(Checklist Parent)
        {
            int i = 1;

            foreach (Item item in Parent.Items.OrderBy(x => x.ID))
            {
                if (item.ID == i)
                {
                    i += 1;
                }
            }
            ID = i;
        }
Exemplo n.º 5
0
        public static bool WriteConfigs(this Checklist cl)
        {
            Task taskw = Task.Run(() =>
            {
                while (Writing)
                {
                }
                Writing = true;
                cl.Items.Serializar(cl.Path);
                Writing = false;
            });

            return(true);
        }
Exemplo n.º 6
0
        public static Checklist GenerateCheckList(string Name, bool Acessible)
        {
            string    path = PastaChecklists + "\\" + Acessible.ToString() + "_" + Name + ".ini";
            Checklist cl   = new Checklist();

            cl.Name       = Name;
            cl.Accessible = Acessible;
            cl.Path       = path;
            if (!File.Exists(path))
            {
                cl.Items.Serializar(cl.Path);
            }
            return(cl);
        }
Exemplo n.º 7
0
        public static Checklist ReadChecklist(string ChecklistPath)
        {
            Task checkWriting = Task.Run(() => { while (Writing)
                                                 {
                                                 }
                                         });

            checkWriting.Wait();
            Checklist cl = new Checklist();

            string[] cut = Path.GetFileName(ChecklistPath).Split('.')[0].Split('_');
            cl.Name       = cut[1];
            cl.Accessible = cut[0] == "True" || cl.Name == Properties.Settings.Default.Nome;
            cl.Items      = ChecklistPath.Deserializar(new Type[1] {
                typeof(Item)
            });
            cl.Path = ChecklistPath;
            return(cl);
        }
Exemplo n.º 8
0
        private void lbItems_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox lb = sender as ListBox;

            if (lb.SelectedIndex != -1)
            {
                string path = lbDisplay.GetPath(lb.SelectedItem);
                CheckAtiva = ChecklistExtensions.ReadChecklist(path);
                if (CheckAtiva.Accessible)
                {
                    lbCheck.ContextMenuStrip = stripChecklist;
                }
                else
                {
                    lbCheck.ContextMenuStrip = null;
                }
                lbCheck.DataSource = CheckAtiva.GetList();
            }
            lbCheck.Focus();
        }
Exemplo n.º 9
0
        private void stripAdicionarRemover_Opening(object sender, CancelEventArgs e)
        {
            ToolStripMenuItem moverParaStrip = (sender as ContextMenuStrip).Items.Find("moverParaToolStripMenuItem", false)[0] as ToolStripMenuItem;

            moverParaStrip.DropDownItems.Clear();
            List <ToolStripMenuItem> Acessibles = new List <ToolStripMenuItem>();

            foreach (object clRef in lbItems.Items)
            {
                Classes.Checklist cl = ChecklistExtensions.ReadChecklist(lbDisplay.GetPath(clRef));
                if (cl.Path != CheckAtiva.Path)
                {
                    ToolStripMenuItem moveStrip = new ToolStripMenuItem()
                    {
                        Name = "MoverPara" + cl.Name + "ToolStripMenu", Text = cl.Name
                    };
                    moveStrip.Click += MoveStrip_Click;
                    moverParaStrip.DropDownItems.Add(moveStrip);
                }
            }
        }
Exemplo n.º 10
0
 public static object GetList(this Checklist cl)
 {
     return(cl.Items);
 }