예제 #1
0
        //private Map<string,  SearchResult { get; }

        public SearchResultVM(string rootDir)
        {
            RootDir      = rootDir;
            ResultGroups = new MyBindingList <SearchResultGroupVM>();

            OnDeleteSelected = new DelegateCommand(_ =>
            {
                string groupKey = SelectedFile.GroupKey;
                //searchResult.Groups.GetValues(groupKey, false).Remove(SelectedFile.FileInfo);

                FileSystem.DeleteFile(SelectedFile.FileInfo.FullName, UIOption.AllDialogs, RecycleOption.SendToRecycleBin);

                foreach (SearchResultGroupVM groupVM in ResultGroups)
                {
                    if (groupVM.GroupHeader == groupKey)
                    {
                        groupVM.Files.Remove(SelectedFile);
                        break;
                    }
                }
            }, _ => {
                return(SelectedFile != null);
            });

            //SearchResult = new SearchResult;


            //SearchResult result = new SearchResult()
            //{
            //    RootDir = null,
            //    Groups = new MultiValueDictionary<string, FileInfo>()
            //};
        }
예제 #2
0
        public SettingsPreFilterVM(MyBindingList <LineFilter> filters)
        {
            this.filters = filters;

            FilterVMs        = new MyBindingList <FilterVM>();
            FilterVMsRemoved = new MyBindingList <FilterVM>();

            FilterVMs.ListChanged += (sender, args) =>
            {
                IsListVisible = FilterVMs.Count > 0;
            };

            Action <FilterVM> removeFromUI = filter =>
            {
                FilterVMs.Remove(filter);
                FilterVMsRemoved.Add(filter);
            };

            AddStartsWithFilter = new DelegateCommand(_ =>
            {
                FilterVM filter = new FilterVM(LineFilterType.StartsWith, removeFromUI);
                FilterVMs.Add(filter);
            });
            AddMatchesRegexFilter = new DelegateCommand(_ =>
            {
                FilterVM filter = new FilterVM(LineFilterType.MatchesRegex, removeFromUI);
                FilterVMs.Add(filter);
            });
        }
예제 #3
0
        public void propagateToBackingMatchers(MyBindingList <IMatcher <IComparable> > matchers, GeneralMatcherVM parent)
        {
            Console.WriteLine("At matcher");
            if (backingMatcher == null)
            {
                // if new matcher was removed before being applied
                if (removed)
                {
                    return;
                }

                // if matcher is new
                backingMatcher = createBackingMatcher();
                updateBackingMatcher(backingMatcher, parent);
                matchers.Add(backingMatcher);
            }
            else
            {
                if (removed)
                {
                    // if existing matcher is removed
                    matchers.Remove(backingMatcher);
                }
                else
                {
                    // if existing matcher was changed
                    updateBackingMatcher(backingMatcher, parent);
                }
            }
        }
예제 #4
0
        /// <summary>
        /// OnLoaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnLoaded(object sender, EventArgs e)
        {
            bfexplorerService.UiApplication = new JayBeeBotHost(SynchronizationContext.Current);

            bets = new MyBindingList <Bet>(this);

            foreach (var botDescriptor in bfexplorerService.BotManager.MyBots)
            {
                int botId = botDescriptor.BotId.Id;

                if (botId <= 9 || botId == 22)
                {
                    botDescriptor.Parameters.Name = botDescriptor.BotId.Name;
                    myBots.Add(botDescriptor);
                }
            }

            bindingSourceRaces.DataSource      = races;
            bindingSourceSelections.DataSource = selections;
            bindingSourceBets.DataSource       = bets;

            listBoxBotsToExecute.DataSource = myBots;

            var outputMessages = new MyBindingList <OutputMessage>(this);

            outputMessages.Attach(bfexplorerService.ServiceStatus.OutputMessages);

            dataGridViewOutput.DataSource = new BindingSource {
                DataSource = outputMessages
            };
        }
예제 #5
0
 public NBindingToIBindingListUC()
 {
     // This call is required by the Windows.Forms Form Designer.
     InitializeComponent();
     m_MyBindingList = new MyBindingList();
     m_TypedList     = new MyList();
     comboBox1.Items.Add("List Of Custom Objects");
     comboBox1.Items.Add("ITypedList");
 }
예제 #6
0
        public MatcherChain()
        {
            Matchers = new MyBindingList <IMatcher <IComparable> >();
            RemainingLineMatcher remainingLineMatcher = new RemainingLineMatcher();

            remainingLineMatcher.Name = "Message";
            RemainingLineMatcher      = remainingLineMatcher;

            Matchers.ListChanged += onMatcherListChanged;
            onMatcherListChanged(null, null);
        }
		// Deserializes downloads.data and assigns it to DownloadEntries [this method is called only once]
		public static void Deserialize()
		{
			if (File.Exists("downloads.dat"))
			{
				IFormatter formatter = new BinaryFormatter();
				using (FileStream stream = File.OpenRead("downloads.dat"))
				{
                    DownloadEntries = (MyBindingList<DownloadEntry>)formatter.Deserialize(stream);
				}
			}
		}
    public Form1()
    {
        InitializeComponent();
        bs = new BindingSource();
        MyBindingList <BackingObject> backing_objects = new MyBindingList <BackingObject>();

        backing_objects.Add(new BackingObject {
            PrimaryKey = 1, Name = "Fred", Hidden = "Fred 1"
        });
        bs.DataSource            = backing_objects;
        dataGridView1.DataSource = bs;
    }
예제 #9
0
        public LogViewDataVM(LogView logView)
        {
            LogAtoms              = logView.Statements;
            LogAtoms.ListChanged += LogAtoms_ListChanged;


            try
            {
                DataTemplate template = (DataTemplate)Application.Current.FindResource("MyTemplate1");
            }
            catch (ResourceReferenceKeyNotFoundException ex)
            {
                ///stuff here to hande
            }
        }
예제 #10
0
        public SearchResultGroupVM(string groupKey, string rootDir, List <FileInfo> files)
        {
            GroupHeader = groupKey;
            var filesTemp = new MyBindingList <SearchResultFileVM>();

            foreach (FileInfo file in files)
            {
                string filePath = file.FullName;
                filePath = filePath.Substring(rootDir.Length);
                filePath = filePath.Substring(0, filePath.Length - file.Name.Length);
                filesTemp.Add(new SearchResultFileVM(filePath, file.Name, groupKey, file));
            }

            Files = filesTemp;
        }
예제 #11
0
        public MainWindow()
        {
            InitializeComponent();
            saveCsvFile     = new SaveCsvCommand();
            openCsvFile     = new OpenCsvCommand(this);
            generateCommand = new GenerateDots(this);
            drawDotsCommand = new DrawDots(this);
            drawBestApproximationCommand    = new DrawBestApproximationLine(this, new ExhaustiveSearch());
            drawAverageApproximationCommand = new DrawBestApproximationLine(this, new AverageAngleSearch());
            middleDotCommand  = new DrawBestApproximationLine(this, new MidpointAngleSearch());
            drawTargetCommand = new DrawTargetToMiddlePoint(this);
            exhaustiveClusterAnalyzerCommand = new DrawClustersCommand(this, new ExhaustiveClusterAnalyzer());

            CurrentDots              = new MyBindingList <Dot>();
            listBox1.DataSource      = CurrentDots;
            CurrentDots.ListChanged += CurrentDots_ListChanged;
        }
예제 #12
0
        public SectionChooseDialog(MyBindingList <SectionObjectRec> sections, SectionObjectRec defaultSection)
        {
            InitializeComponent();
            this.Icon = OutOfPhase.Properties.Resources.Icon2;

            DpiChangeHelper.ScaleFont(this, Program.Config.AdditionalUIZoom);

            string nullSection = "(None)";

            displayList.Add(nullSection);
            foreach (SectionObjectRec section in sections)
            {
                displayList.Add(section);
            }

            myListBoxSections.SetUnderlying(displayList, GetDisplayText);
            myListBoxSections.SelectItem(defaultSection != null ? (object)defaultSection : (object)nullSection, true /*clearOtherSelections*/);
            myListBoxSections.DoubleClick2 += MyListBoxSections_DoubleClick;
        }
예제 #13
0
        public SettingsMatcherVM(MatcherChain matcherChain)
        {
            this.matcherChain = matcherChain;

            MatcherVMs        = new MyBindingList <GeneralMatcherVM>();
            MatcherVMsRemoved = new MyBindingList <GeneralMatcherVM>();

            Action <GeneralMatcherVM> removeFromUI = matcherVM =>
            {
                MatcherVMs.Remove(matcherVM);
                MatcherVMsRemoved.Add(matcherVM);
                matcherVM.IsLevel = false;
            };

            AddMatcher = new DelegateCommand(_ =>
            {
                GeneralMatcherVM matcher = new GeneralMatcherVM(removeFromUI, cleanUpSetLevel);
                matcher.Name             = "Matcher #" + (MatcherVMs.Count + 1);
                MatcherVMs.Add(matcher);
            });
        }
예제 #14
0
        public SettingsLevelVM()
        {
            Levels = new MyBindingList <LevelVM>();

            Action <LevelVM> onRemove = levelVM =>
            {
                Levels.Remove(levelVM);
            };

            AddLevel = new DelegateCommand(_ =>
            {
                Levels.Add(new LevelVM(onRemove)
                {
                    Color = Colors.Black,
                    Name  = "",
                    Show  = true
                });
            });

            addDefaultLevels(onRemove);
        }
예제 #15
0
        public LogView()
        {
            lines      = new List <string>();
            Statements = new MyBindingList <LogAtom>();

            Filters  = new MyBindingList <LineFilter>();
            Matchers = new MatcherChain();

            dirty = new MyBindingList <LogAtom>();

            areFiltersDirty      = false;
            Filters.ListChanged += (sender, args) =>
            {
                areFiltersDirty = true;
            };

            areMatchersDirty          = false;
            Matchers.PropertyChanged += (sender, args) =>
            {
                areMatchersDirty = true;
            };
        }
예제 #16
0
        public void propagateToBackingFilters(MyBindingList <LineFilter> filters)
        {
            if (backingFilter == null)
            {
                // if new filter was removed before being applied
                if (removed)
                {
                    return;
                }

                // if filter is new
                switch (type)
                {
                case LineFilterType.MatchesRegex:
                    backingFilter = new MatchesRegexFilter();
                    break;

                case LineFilterType.StartsWith:
                    backingFilter = new StartsWithFilter();
                    break;
                }
                backingFilter.Pattern = FilterPattern;
                filters.Add(backingFilter);
            }
            else
            {
                if (removed)
                {
                    // if existing filter is removed
                    filters.Remove(backingFilter);
                }
                else
                {
                    // if existing filter was changed
                    backingFilter.Pattern = FilterPattern;
                }
            }
        }
예제 #17
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            SearchCounter = 0;

            OnExit = new DelegateCommand(_ =>
            {
                // TODO interrupt running search threads?
                Application.Current.Shutdown();
            });

            OnNewSearch = new DelegateCommand(_ =>
            {
                var Search = new SearchVM(SearchCounter, searchResultStart =>
                {
                    if (searchResultStart == null)
                    {
                        SearchResult = null;
                    }
                    else
                    {
                        SearchResult = new SearchResultVM(searchResultStart.RootDir);
                    }
                }, searchResultPart =>
                {
                    SearchResult.Add(searchResultPart);
                });
                Searches.Add(Search);
                SearchCounter++;
                SelectedSearch = Search;
            });

            Searches = new MyBindingList <SearchVM>();

            // TODO remove
            OnNewSearch.Execute(null);
        }
예제 #18
0
 public void RegisterEvents(MyBindingList <T> src)
 {
     //this is where you assign src events to your new list
     this.MyAddingNew = src.MyAddingNew;
 }
예제 #19
0
        private readonly MyBindingList <FunctionObjectRec> functionList; // copy

        public FunctionBuilderProxy(Document document, MyBindingList <FunctionObjectRec> functionList)
            : base(document, FunctionBuilderProxy_PropertyName)
        {
            this.functionList = functionList;
        }