Beispiel #1
0
        public void SetOptions(Options o)
        {
            DialogResult = DialogResult.Cancel;
            this.Rules = o.proper;
            defaultFilterList1.SetRules(Rules);
            FilterO = new List<FilterObject>();
            FilterObject defFiltOb;
            defFiltOb = new FilterObject();
            defFiltOb.discription = "Choose files and folders to NOT track";
            defFiltOb.Custom = true;
            defFiltOb.filter = "";
             //   defFiltOb.mode = FilterObject.FilterObjectMode.CHOOSE;
            defFiltOb.use = false;
            defFiltOb.AddToCa(this);
             //   FilterO.Add(defFiltOb);
            foreach (string listIt in o.filterList)
            {
                defFiltOb = new FilterObject();
                defFiltOb.filter = listIt;
                defFiltOb.use = true;
                defFiltOb.mode = FilterObject.FilterObjectMode.KEEP;
                FilterO.Add(defFiltOb);

            }
            if (monitor != null && FilterString != null)
            {
                customFilterList1.SetMonitor(monitor,FilterString);
            }
            customFilterList1.SetCus(FilterO);
        }
        public SelectFilterFromMonitorGroup(Options o, List<string> monitor)
        {
            InitializeComponent();
            m_options = o;
            this.FilterString = o.filterList;
            this.ResizeRedraw = true;
            this.splitContainer1.Panel1.Resize += new EventHandler(Panel1_Resize);
            cusfil = new CustomFilterList();
            FilterObject defFiltOb;
            FilterO = new List<FilterObject>();
            UserAddFilter = new List<FilterObject>();
            MgprF = new FolderTrack.Types.MGProperties();

            foreach (string listIt in FilterString)
            {
                defFiltOb = new FilterObject();
                defFiltOb.mgpro = null;
                defFiltOb.filter = listIt;
                defFiltOb.use = true;
                defFiltOb.mode = FilterObject.FilterObjectMode.KEEP;
                defFiltOb.AddToCa(this);
                FilterO.Add(defFiltOb);
                UserAddFilter.Add(defFiltOb);

            }
            foreach (GuiInfoMGProperties mgpro in o.proper)
            {
                defFiltOb = new FilterObject();
                defFiltOb.mgpro = mgpro;

                defFiltOb.filter = mgpro.description;
                defFiltOb.discription = mgpro.title;
                defFiltOb.use = mgpro.active;
                defFiltOb.mode = FilterObject.FilterObjectMode.PROFILT;
                defFiltOb.AddToCa(this);
                FilterO.Add(defFiltOb);
            }

            cusfil.SetCus(FilterO);
            cusfil.Dock = DockStyle.Fill;

            this.splitContainer1.Panel1.Controls.Add(cusfil);
            TreeNodeFromString = new Dictionary<string, TreeNode>();
            filt = new Filter();
            filt.AddFilter(FilterString);
            PopulateTree(monitor);
        }
        public void HandleFilDoubleClick(object patO)
        {
            string pat = (string) patO;
            FolderUnit fole = new FolderUnit();
            fole.externalLocation = pat;
            if (ZlpIOHelper.DirectoryExists(pat))
            {
                fole.externalLocation += Path.DirectorySeparatorChar;
                fole.type = Delimiter.FOLDER;
            }
            else
            {
                fole.type = Delimiter.FILE;
            }
            FilterFileForm fiFor = new FilterFileForm(fole, FilterString, null, null);
            fiFor.ShowDialog();
            if (fiFor.DialogResult == DialogResult.OK)
            {
               FilterChangeOb list= fiFor.GetLists();
               foreach (string addl in list.addFilfer)
               {
                   filt.AddFilter(addl);
               }

               foreach (string remol in list.removeFilter)
               {
                   filt.RemoveFilter(remol);
               }

                FilterObject defFiltOb;
                List<FilterObject> Addit = new List<FilterObject>();
                foreach (string listIt in list.addFilfer)
                {
                    if (FilterString.Contains(listIt) == false)
                    {
                        defFiltOb = new FilterObject();
                        defFiltOb.filter = listIt;
                        defFiltOb.use = true;
                        defFiltOb.mode = FilterObject.FilterObjectMode.KEEP;
                        defFiltOb.AddToCa(this);
                        //Note needed because cusfil.AddFil(Addit);
                        // will do FilterO.Add(defFiltOb);
                        Addit.Add(defFiltOb);
                        FilterString.Add(listIt);
                    }

                }

                cusfil.AddFil(Addit);
                UserAddFilter.AddRange(Addit);
            }
            try
            {
                this.MonGroTreeView.Invoke(new VoidNoArgDelegate(SetFilteredFiles));
            }
            catch (InvalidOperationException)
            {
                //throw away
            }
        }