Ejemplo n.º 1
0
        public MainPresenter(IMainForm mainForm, IModel model, IWindowManager windowManager)
        {
            files = new ObservableDistinctCollection();

            files.CollectionChanged += (o, arg) =>
            {
                switch (arg.Action)
                {
                case NotifyCollectionChangedAction.Add:
                {
                    mainFormView.AddItem(((FileInfo)arg.NewItems[0]).Name);
                    break;
                }

                case NotifyCollectionChangedAction.Remove:
                {
                    mainFormView.RemoveItem(arg.OldStartingIndex);
                    break;
                }
                }
                mainFormView.FilesCount = files.Count;
            };

            this.mainFormView = mainForm;

            this.model = model;

            this.windowManager = windowManager;

            mainFormView.FilesCount = 0;

            mainFormView.InitializeStartConfiguration();

            mainFormView.StartSearchClick += ViewStartSearch;
            mainFormView.StopSearchClick  += ViewStopSearch;
            mainFormView.ResultSelected   += View_ResultSelected;
            mainFormView.OpenClick        += View_OpenClick;
            mainFormView.ShowClick        += View_ShowClick;
            mainFormView.ClearClick       += View_ClearClick;
            mainFormView.AllDrivesClick   += View_AllDrivesClick;
            mainFormView.CopyClick        += View_CopyClick;
            mainFormView.MoveClick        += View_MoveClick;
            mainFormView.DeleteClick      += View_DeleteClick;
            mainForm.AboutClick           += MainForm_AboutClick;

            SetProcessPriority(ProcessPriorityClass.High);

            SetThreadPriority(ThreadPriority.AboveNormal);

            ProcessCommandLineArgs();

            programStatus = ProgramStatus.ReadyToSearch;
        }