示例#1
0
 public TourListViewModel(IWindowFactory windowFactorySave, IWindowFactory windowFactoryEdit, IWindowFactory windowFactoryDelete, IWindowFactory windowFactoryImport)
 {
     _windowFactorySave   = windowFactorySave;
     _windowFactoryEdit   = windowFactoryEdit;
     _windowFactoryDelete = windowFactoryDelete;
     _windowFactoryImport = windowFactoryImport;
 }
        public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory)
        {
            _objectProvider = objectProvider;
            _interTabClient = new InterTabClient(windowFactory);
            _showMenuCommand =  new Command(ShowMenu,()=> Selected!=null && !(Selected.Content is MenuItems));
            _showInGitHubCommand = new Command(()=>   Process.Start("https://github.com/RolandPheasant"));

            var menuController = _data.ToObservableChangeSet()
                                        .Filter(vc => vc.Content is MenuItems)
                                        .Transform(vc => (MenuItems) vc.Content)
                                        .MergeMany(menuItem => menuItem.ItemCreated)
                                        .Subscribe(item =>
                                        {
                                            _data.Add(item);
                                            Selected = item;
                                        });
            

            _cleanUp = Disposable.Create(() =>
                                         {
                                             menuController.Dispose();
                                             foreach (var disposable in  _data.Select(vc=>vc.Content).OfType<IDisposable>())
                                                 disposable.Dispose();
                                         });
        }
 public TemplateBuilderViewModel(Action onClose, IWindowFactory windowFactory, IBillOfMaterial sourceBillOfMaterial,
                                 IBillOfMaterial targetBillOfMaterial, UnitOfWork unitOfWork) :
     base(onClose, windowFactory, sourceBillOfMaterial, targetBillOfMaterial, unitOfWork)
 {
     AddItemToTargetByButtonCommand      = new RelayCommand(o => AddByButton(), o => CalculateCanAddItem());
     RemoveItemFromTargetByButtonCommand = new RelayCommand(o => RemoveByButton(), o => CalculateCanRemoveItem());
 }
 public AuthorizationViewModel(IAuthorizationService authorizationService, IWindowFactory windowFactory, IDialogService dialogService)
 {
     _authorizationService = authorizationService;
     _windowFactory        = windowFactory;
     _dialogService        = dialogService;
     LogInCommand          = new DelegateCommandAsync(ExecutePrintResultAuthorization);
 }
示例#5
0
 public WindowPresentService(IWindowFactory windowFactory,
                             IWindowPostionsService postionsService, IEventBusRegistrator registrator)
 {
     _windowFactory   = windowFactory;
     _postionsService = postionsService;
     _registrator     = registrator;
 }
示例#6
0
        public RegistrationSuccessPanelViewModel(String username, IRegistrationViewModel regwindow, IWindowFactory winfactory)
        {
            _UserName           = username;
            _RegistrationWindow = regwindow;

            _WindowFactory = winfactory;
        }
示例#7
0
 public ScheduleInfoEditorViewModel(IWindowFactory windowFactory, IWindowController windowController, IDataManager dataManager, Schedule schedule, bool edit)
     : base(windowFactory, windowController)
 {
     selectedDayOfWeek = DateCharacteristic.GetDayOfWeek(schedule.DayOfWeek);
     selectedHour      = schedule.Hour.ToString();
     selectedMinute    = schedule.Minute.ToString();
     this.dataManager  = dataManager;
     this.edit         = edit;
     this.schedule     = new ScheduleViewModel(schedule);
     scheduleModel     = schedule;
     ready             = new RelayCommand(ReadyExecute, _ => CanReadyExecute);
     cancel            = new RelayCommand(CancelExecute);
     addProduct        = new RelayCommand(AddProductExecute, _ => CanAddProduct);
     addDish           = new RelayCommand(AddDishExecute, _ => CanAddDish);
     delete            = new RelayCommand(DeleteExecute, _ => CanDeleteFood);
     dishes            = new ObservableCollection <DishViewModel>();
     products          = new ObservableCollection <FoodViewModel>();
     food = new ObservableCollection <FoodViewModel>();
     foreach (Dish d in dataManager.GetDishList())
     {
         dishes.Add(new DishViewModel(d));
     }
     foreach (Product p in dataManager.GetProductList())
     {
         products.Add(new FoodViewModel(p));
     }
     foreach (Food f in scheduleModel.Food)
     {
         food.Add(new FoodViewModel(f));
     }
 }
示例#8
0
        public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory)
        {
            _objectProvider     = objectProvider;
            InterTabClient      = new InterTabClient(windowFactory);
            OpenFileCommand     = new Command(OpenFile);
            ShowInGitHubCommand = new Command(() => Process.Start("https://github.com/RolandPheasant"));

            var fileDropped    = DropMonitor.Dropped.Subscribe(OpenFile);
            var isEmptyChecker = Views.ToObservableChangeSet()
                                 .Count()
                                 .StartWith(0)
                                 .Select(count => count == 0)
                                 .Subscribe(isEmpty => IsEmpty = isEmpty);

            _cleanUp = Disposable.Create(() =>
            {
                isEmptyChecker.Dispose();
                fileDropped.Dispose();
                DropMonitor.Dispose();
                foreach (var disposable in  Views.Select(vc => vc.Content).OfType <IDisposable>())
                {
                    disposable.Dispose();
                }
            });
        }
 public PokemonEditorWindowFactory(IWindowFactory windowFactory,
     ExportFactory<IPokemonEditorView> pokemonEditorViewFactory)
 {
     Check.IfIsNull(windowFactory).Throw<ArgumentNullException>(() => windowFactory);
     this.windowFactory = windowFactory;
     this.pokemonEditorViewFactory = pokemonEditorViewFactory;
 }
示例#10
0
        /// <summary>
        /// Stores references to dependencies and initialises object properties.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="loader"></param>
        /// <param name="messenger"></param>
        public LoginViewModel(IMessenger messenger, IServiceFactory svcfactory, IWindowFactory winfactory)
        {
            if (messenger == null)
            {
                throw new ArgumentNullException("The messenger cannot be null.");
            }

            if (svcfactory == null)
            {
                throw new ArgumentNullException("The service factory cannot be null.");
            }

            if (winfactory == null)
            {
                throw new ArgumentNullException("The window factory cannot be null.");
            }

            _Messenger      = messenger;
            _ServiceFactory = svcfactory;
            _WindowFactory  = winfactory;

            _IsLoadingVisible = false;

            Username = GetStoredUsername();
            Password = GetStoredPassword();

            InitialiseRememberMeCheckBox();
        }
示例#11
0
 public CreateOrderMenuComponent(
     IEventAggregator eventAggregator,
     IWindowFactory windowFactory,
     ICallScopeFactory callScopeFactory)
     : base(eventAggregator, windowFactory, callScopeFactory)
 {
 }
 public WindowService(ISettingsHelper settingsHelper, ISettingsService settingsService, IAuthorizationService authorizationService, IWindowFactory windowFactory)
 {
     _settingsHelper       = settingsHelper;
     _settingsService      = settingsService;
     _authorizationService = authorizationService;
     _windowFactory        = windowFactory;
 }
示例#13
0
        /// <summary>
        /// Initilizes a new configution of a quotation
        /// </summary>
        /// <param name="window">A class that implements IWindowFactory</param>
        /// <param name="quotation">The quoation that need to be configured</param>
        public ConfigureQuotationViewModel(Action onClose, QuotationViewModel quotation, ObservableCollection <CustomerViewModel> activeCustomers,
                                           IWindowFactory windowFactory, UnitOfWork unitOfWork) : base(onClose)
        {
            Quotation      = quotation;
            _windowFactory = windowFactory;
            _unitOfWork    = unitOfWork;

            QuotationStatuses = new ObservableCollection <string>()
            {
                "Created",
                "Sent",
                "Lost",
                "Confirmed",
                "Canceled"
            };

            CurrentStatusType = Quotation.CurrentStatus.Type;

            NeedToBeAdded = false;

            ActiveCustomers = activeCustomers;
            CurrentDeadline = Quotation.Deadline.ToShortDateString();

            if (Quotation.Customer != null)
            {
                SelectedCustomerIndex = ActiveCustomers.IndexOf(ActiveCustomers.Where(x => x.ID == Quotation.Customer.ID).FirstOrDefault());
            }

            // Commands
            SaveCommand   = new RelayCommand(o => SaveChanges(), o => true);
            CancelCommand = new RelayCommand(CancelDialog, o => true);
        }
示例#14
0
 public LayoutConverter([NotNull] IWindowFactory windowFactory,
                        [NotNull] IViewFactoryProvider viewFactoryProvider,
                        [NotNull] ISchedulerProvider schedulerProvider,
                        [NotNull] GeneralOptionsViewModel generalOptionsViewModel)
 {
     if (windowFactory == null)
     {
         throw new ArgumentNullException(nameof(windowFactory));
     }
     if (viewFactoryProvider == null)
     {
         throw new ArgumentNullException(nameof(viewFactoryProvider));
     }
     if (schedulerProvider == null)
     {
         throw new ArgumentNullException(nameof(schedulerProvider));
     }
     if (generalOptionsViewModel == null)
     {
         throw new ArgumentNullException(nameof(generalOptionsViewModel));
     }
     _windowFactory           = windowFactory;
     _viewFactoryProvider     = viewFactoryProvider;
     _schedulerProvider       = schedulerProvider;
     _generalOptionsViewModel = generalOptionsViewModel;
 }
        public MainViewModel(Action onClose, IWindowFactory windowFactory, IPageFactory pageFactory) : base(onClose)
        {
            // Deletes existing database and seeds it with predefined data
            DataSeeder dataSeeder = new DataSeeder();

            dataSeeder.SeedAll();

            // Window services.
            _windowFactory = windowFactory;
            _pageFactory   = pageFactory;

            // Setup quotation page view
            QuotationPage         = _pageFactory.GetNewPageInstanceAsObject(PageType.QuotationPageView);
            _quotationPageService = _pageFactory.GetPageService(QuotationPage);

            // Setup customer page view
            CustomerPage         = _pageFactory.GetNewPageInstanceAsObject(PageType.CustomerPageView);
            _customerPageService = _pageFactory.GetPageService(CustomerPage);

            // Setup item page view
            ItemPage          = _pageFactory.GetNewPageInstanceAsObject(PageType.ItemPageView);
            _itemsPageService = _pageFactory.GetPageService(ItemPage);

            // Setup template page view
            TemplatePage         = _pageFactory.GetNewPageInstanceAsObject(PageType.TemplatePageView);
            _templatePageService = _pageFactory.GetPageService(TemplatePage);

            SelectedTabIndex = 0;
        }
 public NotificationsViewModel(
     IWindowFactory window,
     FullscreenAppViewModel mainModel)
 {
     this.window = window;
     MainModel   = mainModel;
 }
示例#17
0
 public MainMenuViewModel(
     IWindowFactory window,
     FullscreenAppViewModel mainModel)
 {
     this.window    = window;
     this.MainModel = mainModel;
 }
示例#18
0
        public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory)
        {
            _objectProvider = objectProvider;
            InterTabClient = new InterTabClient(windowFactory);
            OpenFileCommand =  new Command(OpenFile);
            ShowInGitHubCommand = new Command(()=>   Process.Start("https://github.com/RolandPheasant"));

            Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}";

            var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile);
            var isEmptyChecker = Views.ToObservableChangeSet()
                                    .Count()
                                    .StartWith(0)
                                    .Select(count=>count==0)
                                    .Subscribe(isEmpty=> IsEmpty = isEmpty);

            _cleanUp = Disposable.Create(() =>
                                         {
                                             isEmptyChecker.Dispose();
                                             fileDropped.Dispose();
                                             DropMonitor.Dispose();
                                             foreach (var disposable in  Views.Select(vc=>vc.Content).OfType<IDisposable>())
                                                 disposable.Dispose();
                                         });
        }
示例#19
0
        public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory)
        {
            _objectProvider     = objectProvider;
            InterTabClient      = new InterTabClient(windowFactory);
            _showMenuCommand    = new Command(ShowMenu, () => Selected != null && !(Selected.Content is MenuItems));
            ShowInGitHubCommand = new Command(() => Process.Start("https://github.com/RolandPheasant"));

            var menuController = Views.ToObservableChangeSet()
                                 .Filter(vc => vc.Content is MenuItems)
                                 .Transform(vc => (MenuItems)vc.Content)
                                 .MergeMany(menuItem => menuItem.ItemCreated)
                                 .Subscribe(item =>
            {
                Views.Add(item);
                Selected = item;
            });


            _cleanUp = Disposable.Create(() =>
            {
                menuController.Dispose();
                foreach (var disposable in  Views.Select(vc => vc.Content).OfType <IDisposable>())
                {
                    disposable.Dispose();
                }
            });
        }
        public MainViewModel(IPreferencesManager preferencesManager, 
                             IWindowFactory windowFactory, 
                             IDelegateCommand selectedPreferenceCommand, 
                             IDelegateCommand savePreferenceCommand,
                             IDelegateCommand saveAllCommand,
                             IDelegateCommand openFileCommand,
                             IPreferenceTypeViewModel preferenceTypeViewModel)
            : base()
        {
            _PreferencesManager = preferencesManager;
            _WindowFactory = windowFactory;
            _PreferenceTypeViewModel = preferenceTypeViewModel;

            selectedPreferenceCommand.ExecuteAction = p => SetSelectedPreference(p);
            savePreferenceCommand.ExecuteAction = p => SavePreference(p);
            saveAllCommand.ExecuteAction = p => SaveAll();
            openFileCommand.ExecuteAction = p => OpenFile();

            SelectedPreferenceCommand = selectedPreferenceCommand;
            SavePreferenceCommand = savePreferenceCommand;
            SaveAllCommand = saveAllCommand;
            OpenFileCommand = openFileCommand;

            Preferences = new ObservableCollection<IPreferenceViewModel>();
        }
示例#21
0
 public ScheduleManagerViewModel(IWindowFactory windowFactory, IWindowController windowController, IDataManager dataManager, int userId)
     : base(windowFactory, windowController)
 {
     this.userId      = userId;
     this.dataManager = dataManager;
     schedules        = new ObservableCollection <ScheduleViewModel>();
     LoadSchedulesList();
     add = new RelayCommand(_ =>
     {
         Schedule model = new Schedule();
         model.UserId   = userId;
         windowFactory.CreateScheduleInfoEditorWindow(model, false);
         LoadSchedulesList();
     });
     edit = new RelayCommand(_ =>
     {
         windowFactory.CreateScheduleInfoEditorWindow(dataManager.GetScheduleById(userId, selectedSchedule.Id), true);
         LoadSchedulesList();
     }, _ => CanEditOrDelete);
     delete = new RelayCommand(_ =>
     {
         dataManager.RemoveSchedule(selectedSchedule.UserId, selectedSchedule.Id);
         LoadSchedulesList();
     }, _ => CanEditOrDelete);
 }
        public RegistrationSuccessPanelViewModel(String username, IRegistrationViewModel regwindow, IWindowFactory winfactory)
        {
            _UserName = username;
            _RegistrationWindow = regwindow;

            _WindowFactory = winfactory;
        }
示例#23
0
 public AppCommands(IWindowFactory windowFactory)
 {
     _windowFactory      = windowFactory;
     ShowLicenseCommand  = new RelayCommand(showLicense);
     ShowAboutCommand    = new RelayCommand(showAbout);
     ShowSettingsCommand = new RelayCommand(showSettings);
 }
 public EditDeleteLogViewModel(IWindowFactory windowFactoryEdit, ILog log)
 {
     _windowFactoryEdit = windowFactoryEdit;
     ObserverSingleton.GetInstance.LogObservers.ForEach(Attach);
     _log = log;
     log4net.Config.XmlConfigurator.Configure();
 }
        public void TestInitialize()
        {
            _template = new TemplateViewModel(new Template());
            _module   = new ModuleViewModel(new Module());
            UnitOfWork       unitOfWork     = new UnitOfWork(new ElogicSystemContext());
            ProductViewModel itemViewModel1 = new ProductViewModel(new Product()
            {
                ID = 1, Description = "TEST",
            });
            ProductViewModel itemViewModel2 = new ProductViewModel(new Product()
            {
                ID = 2, Description = "TEST2"
            });
            ProductViewModel itemViewModel3 = new ProductViewModel(new Product()
            {
                ID = 3, Description = "TEST2"
            });
            ModuleViewModel module1 = new ModuleViewModel(new Module());

            module1.Add(itemViewModel3);

            _template.Add(itemViewModel1);
            _template.Add(itemViewModel2);
            _template.Add(module1);
            _windowFactory    = new WindowFactoryMock();
            _windowService    = _windowFactory.GetWindowService(WindowType.PanelBuilderView);
            _builderViewModel = new BuilderViewModel(_windowService.Close, _windowFactory, _template, _module, unitOfWork);
        }
        /// <summary>
        ///     Initializes a new instance of the MainWindowViewModel class.
        /// </summary>
        public MainWindowViewModel(IProviderService providerService, ILinkParser linkParser,
                                   IWindowFactory windowFactory,
                                   IViewModelFactory viewModelFactory, IDbContext dbContext, Logger logger)
        {
            _dbContext        = dbContext;
            _logger           = logger;
            _linkParser       = linkParser;
            _windowFactory    = windowFactory;
            Instance          = this;
            ProviderService   = providerService;
            _viewModelFactory = viewModelFactory;
            SnackbarQueue     = new SnackbarMessageQueue();
            StartStopCommand  = new ActionCommand(StartStop);
            RefreshCommand    = new ActionCommand(() => ProviderService.Timer = 5);
            OpenViewerCommand = new ActionCommand(ParseLink);

            ProviderService.Run().ConfigureAwait(false);

            //test PEPE
            //WebParser.GetRssFeedAsync("https://yomanga.co/reader/feeds/rss").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("https://gameofscanlation.moe/projects/trinity-wonder/index.rss").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("http://bato.to/myfollows_rss?secret=dd5831f7430c7ed7ea7055db4fe7b7ad&l=English").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("http://read.tomochan.today/rss").ConfigureAwait(false);
            //WebParser.GetRssFeedAsync("http://www.webtoons.com/en/fantasy/tower-of-god/rss?title_no=95").ConfigureAwait(false);
            _logger.Log.Info("starting");
            //SnackbarQueue.Enqueue("Starting...", true);
        }
示例#27
0
        public SettingsViewModel(IWindowFactory windowFactory) : base(windowFactory)
        {
            Logger = MainController.Get().Logger;


            RunCommand = new RelayCommand(Run, CanRun);
        }
        public BuilderViewModel(Action onClose, IWindowFactory windowFactory, IBillOfMaterial sourceBillOfMaterial, IBillOfMaterial targetBillOfMaterial, UnitOfWork unitOfWork) : base(onClose)
        {
            // Get window.
            _windowFactory = windowFactory;
            _unitOfWork    = unitOfWork;

            SourceBillOfMaterial = sourceBillOfMaterial;
            TargetBillOfMaterial = targetBillOfMaterial;

            SyncSourceQuantities(TargetBillOfMaterial.ItemViewModels);

            SourceHierarchyDataGrid = new HierarchyDataGrid(SourceBillOfMaterial.ItemViewModels);
            TargetHierarchyDataGrid = new HierarchyDataGrid(TargetBillOfMaterial.ItemViewModels);

            AddItemToTargetByButtonCommand      = new RelayCommand(o => AddByButton(), o => CanAddByButton());
            RemoveItemFromTargetByButtonCommand = new RelayCommand(o => RemoveByButton(), o => CanRemoveByButton());

            AddSelectedItemInSource = new RelayCommand(o => AddRemoveSelectedItemIfValid(_selectedItemInSource), o => _selectedItemInSource != null);
            AddSelectedItemInTarget = new RelayCommand(o => AddRemoveSelectedItemIfValid(_selectedItemInTarget), o => _selectedItemInTarget != null);

            ShowCancelDialogCommand         = new RelayCommand(CancelDialog, o => true);
            HideSourceViewCommand           = new RelayCommand(o => IsSourceViewHidden = true, o => IsSourceViewHidden == false);
            ShowSourceViewCommand           = new RelayCommand(o => IsSourceViewHidden = false, o => IsSourceViewHidden == true);
            SaveTargetBillOfMaterialCommand = new RelayCommand(SaveTargetOnSaveCommand, o => true);

            CalculateInfo();
        }
        public virtual bool SetWindowFactory(IWindowFactory windowFactory, bool throwException = true)
        {
            if (windowFactory is TFactory factory)
            {
                try {
                    this.WindowFactory = factory;
                    return(true);
                } catch (InvalidOperationException) {
                    if (throwException)
                    {
                        throw;
                    }
                }
            }
            else if (windowFactory == null)
            {
                this.WindowFactory = default(TFactory);
                return(true);
            }
            else
            {
                if (throwException)
                {
                    throw new InvalidCastException(nameof(TFactory));
                }
            }

            return(false);
        }
示例#30
0
        public static SmartWindow GetWindowFor(IWindowFactory factory, IWindow viewModel = null,
                                               bool createNewIfMultipleAllowed           = true)
        {
            SmartWindow drawer = null;

            if (factory.Multiple && createNewIfMultipleAllowed)
            {
            }
            else if (factory.Multiple && !createNewIfMultipleAllowed)
            {
                drawer = GetByFactoryId(factory.Identifier).FirstOrDefault() as SmartWindow;
            }
            else if (!factory.Multiple)
            {
                drawer = GetByFactoryId(factory.Identifier).FirstOrDefault() as SmartWindow;
            }

            if (drawer == null)
            {
                drawer = ScriptableObject.CreateInstance <SmartWindow>();
                drawer.WindowFactoryId = factory.Identifier;
                BindDrawerToWindow(drawer, factory, viewModel);
            }

            return(drawer);
        }
示例#31
0
 public void SetUp()
 {
     _authorizationService = A.Fake <IAuthorizationService>();
     _windowFactory        = A.Fake <IWindowFactory>();
     _applicationService   = A.Fake <IApplicationService>();
     _windowService        = A.Fake <IWindowService>();
     _trayViewModel        = new TrayViewModel(_authorizationService, _windowFactory, _applicationService, _windowService);
 }
 public CasesPageViewModel()
 {
     this._viewModel = new CasesViewModel();
     this._cases = _viewModel.AllCases;
     this._casesForDisplay = this._cases;
     this._receptionist = new Receptionist();
     this._windowFactory = new ProductionWindowFactory();
 }
 public OpenWindowViewModel(IWindowFactory windowFactory)
 {
     this.windowFactory   = windowFactory;
     openNewWindowCommand = new RelayCommand(obj =>
     {
         DoOpenNewWindow();
     });
 }
 public PatientsPageViewModel()
 {
     _viewModel = new PatientsViewModel();
     _allPatients = _viewModel.AllPatients;
     _patientsForDisplay = _allPatients;
     _receptionist = new Receptionist();
     _windowFactory = new ProductionWindowFactory();
 }
 public void SetUp()
 {
     _settingsService      = A.Fake <ISettingsService>();
     _authorizationService = A.Fake <IAuthorizationService>();
     _windowFactory        = A.Fake <IWindowFactory>();
     _settingsHelper       = A.Fake <ISettingsHelper>();
     _settingsViewModel    = new SettingsViewModel(_settingsService, _authorizationService, _windowFactory, _settingsHelper);
 }
示例#36
0
 public PatientsPageViewModel()
 {
     _viewModel          = new PatientsViewModel();
     _allPatients        = _viewModel.AllPatients;
     _patientsForDisplay = _allPatients;
     _receptionist       = new Receptionist();
     _windowFactory      = new ProductionWindowFactory();
 }
 public void SetUp()
 {
     _authorizationService = A.Fake <IAuthorizationService>();
     _windowFactory        = A.Fake <IWindowFactory>();
     _settingsHelper       = A.Fake <ISettingsHelper>();
     _settingsService      = A.Fake <ISettingsService>();
     _windowService        = new WindowService(_settingsHelper, _settingsService, _authorizationService, _windowFactory);
 }
示例#38
0
 public LayoutConverter([NotNull] IWindowFactory windowFactory,
     [NotNull] IViewFactoryProvider viewFactoryProvider,
     [NotNull] ISchedulerProvider schedulerProvider)
 {
     if (windowFactory == null) throw new ArgumentNullException(nameof(windowFactory));
     if (viewFactoryProvider == null) throw new ArgumentNullException(nameof(viewFactoryProvider));
     if (schedulerProvider == null) throw new ArgumentNullException(nameof(schedulerProvider));
     _windowFactory = windowFactory;
     _viewFactoryProvider = viewFactoryProvider;
     _schedulerProvider = schedulerProvider;
 }
        public ItemEditorWindowFactory(IItemEditorClosingHandler itemEditorClosingHandler, IWindowFactory windowFactory,
            IItemEditorView itemEditorView)
        {
            Check.IfIsNull(itemEditorClosingHandler).Throw<ArgumentNullException>(() => itemEditorClosingHandler);
            Check.IfIsNull(windowFactory).Throw<ArgumentNullException>(() => windowFactory);
            Check.IfIsNull(itemEditorView).Throw<ArgumentNullException>(() => itemEditorView);

            this.itemEditorClosingHandler = itemEditorClosingHandler;
            this.windowFactory = windowFactory;
            this.itemEditorView = itemEditorView;
        }
示例#40
0
        public WindowViewModel(IObjectProvider objectProvider, 
            IWindowFactory windowFactory, 
            ILogger logger,
            IWindowsController windowsController,
            RecentFilesViewModel recentFilesViewModel,
            GeneralOptionsViewModel generalOptionsViewModel,
            ISchedulerProvider schedulerProvider)
        {
            _logger = logger;
            _windowsController = windowsController;
            RecentFiles = recentFilesViewModel;
            GeneralOptions = generalOptionsViewModel;
            _schedulerProvider = schedulerProvider;
            _objectProvider = objectProvider;
            InterTabClient = new InterTabClient(windowFactory);
            OpenFileCommand =  new Command(OpenFile);
            ShowInGitHubCommand = new Command(()=>   Process.Start("https://github.com/RolandPheasant"));

            ZoomOutCommand= new Command(()=> { GeneralOptions.Scale = GeneralOptions.Scale + 5; });
            ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; });
            SaveLayoutCommand = new Command(WalkTheLayout);
            ExitCommmand = new Command(() => Application.Current.Shutdown());

            Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}";

            var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile);
            var isEmptyChecker = Views.ToObservableChangeSet()
                                    .ToCollection()
                                    .Select(items=>items.Count)
                                    .StartWith(0)
                                    .Select(count=>count==0)
                                    .Subscribe(isEmpty=> IsEmpty = isEmpty);

            var openRecent = recentFilesViewModel.OpenFileRequest
                                .Subscribe(file =>
                                {
                                    MenuIsOpen = false;
                                    OpenFile(file);
                                });

            _cleanUp = new CompositeDisposable(recentFilesViewModel,
                isEmptyChecker,
                fileDropped,
                DropMonitor,
                openRecent,
                Disposable.Create(() =>
                {
                     Views.Select(vc => vc.Content)
                            .OfType<IDisposable>()
                            .ForEach(d=>d.Dispose());
                }));
        }
示例#41
0
        // If DI is about removing all "new" operators from your logic to enable a plugin architecture where
        // every component can be changed in one place and that we must rely on abstraction rather than concretions
        // then everything must implement an interface and be passed in on the constructor (even other windows)
        // Thiscould be useful as for instance: if you wanted to replace the Expression builder then we change it
        // when we load our Ninject Kernel in App.xaml (Via IExpressionBuilderWindowFactory). Then if we called
        // that screen from other windows (such as we do in Find) later on in the stack the change is only in one place
        // I fully intend to remove all "new" operators from this code file as a test to see how plausible it is to do!
        // I have left += new event handlers and any temporary news like StringBuilder
        public MainWindow(RecentFileList recentFileList, ILastOpenFilesData lastOpenFilesData,
            IHighlightItemData highlightItemData, IWindowFactory windowFactory, IFindWindowFactory findWindowFactory, ISystemTray systemTray,
            System.Windows.Forms.NotifyIcon notifyIcon, ISaveExpressionMessageWindowFactory saveExpressionMessageWindowFactory,
            IExpressionBuilderWindowFactory expressionBuilderWindowFactory, IFileFactory fileFactory, ITabItemFactory tabItemFactory, ISettingsHelper settingsHelper,
            IHighlightWindowFactory highlightWindowFactory, IHighlightsHelper highlightsHelper)
        {
            this.SettingsHelper = settingsHelper;
            this.LastOpenFilesData = lastOpenFilesData;
            this.recentFileList = recentFileList;
            this.WindowFactory = windowFactory;
            this.FindWindowFactory = findWindowFactory;
            this.HighlightItemData = highlightItemData;
            this.SaveExpressionMessageWindowFactory = saveExpressionMessageWindowFactory;
            this.ExpressionBuilderWindowFactory = expressionBuilderWindowFactory;
            this.SystemTray = systemTray;
            this.FileFactory = fileFactory;
            this.TabItemFactory = tabItemFactory;
            this.HighlightWindowFactory = highlightWindowFactory;
            this.HighlightHelper = highlightsHelper;

            InitializeComponent();

            this.recentFileList.SubMenuClick +=new EventHandler<EventArgs>(recentFileList_SubMenuClick);
            this.MenuItemFile.Items.Insert(2, this.recentFileList);

            // Null Object pattern (http://en.wikipedia.org/wiki/Null_Object_pattern)
            this.OpenWindows = new List<IWindow>(0);
            this.LastOpenFiles = new List<IFile>(0);

            this.Notify = notifyIcon;
            this.Notify.Icon = this.SystemTray.Icon;
            this.Notify.DoubleClick += new EventHandler(Notify_DoubleClick);
            this.Notify.ContextMenu = this.SystemTray.ContextMenu;

            this.Notify.ContextMenu.MenuItems[0].Click += new EventHandler(disableSoundsMenuItem_Click);
            this.Notify.ContextMenu.MenuItems[1].Click += new EventHandler(minimuseToTrayItem_Click);
            this.Notify.ContextMenu.MenuItems[3].Click += new EventHandler(exitItem_Click);

            this.Notify.Visible = true;
        }
 public GetWindowLocationHandler(IWindowFactory windowFactory, IWindowUtils windowUtils)
 {
     this.windowFactory = windowFactory;
     this.windowUtils = windowUtils;
 }
示例#43
0
 /// <summary>
 /// Instantiates a new instance of the <see cref="ArrWindowFactory"/> class
 /// </summary>
 /// <param name="windowFactory"></param>
 public ArrWindowFactory(IWindowFactory windowFactory)
 {
     this._windowFactory = windowFactory;
 }
示例#44
0
 public WindowUtils(IUIAutomation uiAutomation, IWindowFactory windowFactory)
 {
     this.uiAutomation = uiAutomation;
     this.windowFactory = windowFactory;
 }
 public GetWindowSizeHandler(IWindowFactory windowFactory, IWindowUtils windowUtils)
 {
     this.windowFactory = windowFactory;
     this.windowUtils = windowUtils;
 }
示例#46
0
 public MainWindow(IWindowFactory windowFactory)
 {
     _windowFactory = windowFactory;
     InitializeComponent();
 }
示例#47
0
        /// <summary>
        /// Stores references to dependencies and initialises object properties.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="loader"></param>
        /// <param name="messenger"></param>
        public LoginViewModel(IMessenger messenger, IServiceFactory svcfactory, IWindowFactory winfactory)
        {
            if (messenger == null)
                throw new ArgumentNullException("The messenger cannot be null.");

            if (svcfactory == null)
                throw new ArgumentNullException("The service factory cannot be null.");

            if (winfactory == null)
                throw new ArgumentNullException("The window factory cannot be null.");

            _Messenger = messenger;
            _ServiceFactory = svcfactory;
            _WindowFactory = winfactory;

            _IsLoadingVisible = false;

            Username = GetStoredUsername();
            Password = GetStoredPassword();

            InitialiseRememberMeCheckBox();
        }
        public WindowViewModel(IObjectProvider objectProvider, 
            IWindowFactory windowFactory, 
            ILogger logger,
            IWindowsController windowsController,
            RecentFilesViewModel recentFilesViewModel,
            GeneralOptionsViewModel generalOptionsViewModel,
            ISchedulerProvider schedulerProvider,
            IApplicationStatePublisher applicationStatePublisher)
        {
            _logger = logger;
            _windowsController = windowsController;
            RecentFiles = recentFilesViewModel;
            GeneralOptions = generalOptionsViewModel;
            _schedulerProvider = schedulerProvider;
            _objectProvider = objectProvider;
            InterTabClient = new InterTabClient(windowFactory);
            OpenFileCommand =  new Command(OpenFile);

            ShowInGitHubCommand = new Command(()=>   Process.Start("https://github.com/RolandPheasant"));
            ZoomOutCommand= new Command(()=> { GeneralOptions.Scale = GeneralOptions.Scale + 5; });
            ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; });
            CollectMemoryCommand = new Command(() =>
            {
                //Diagnostics [useful for memory testing]
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
            });
            ExitCommmand = new Command(() =>
            {
                applicationStatePublisher.Publish(ApplicationState.ShuttingDown);
                Application.Current.Shutdown();
            });
            WindowExiting = () =>
            {
                applicationStatePublisher.Publish(ApplicationState.ShuttingDown);
            };

            Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}";

            var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile);

            var isEmptyChecker = Views.ToObservableChangeSet()
                                    .ToCollection()
                                    .Select(items=>items.Count)
                                    .StartWith(0)
                                    .Select(count=>count==0)
                                    .LogErrors(logger)
                                    .Subscribe(isEmpty=> IsEmpty = isEmpty);

            var openRecent = recentFilesViewModel.OpenFileRequest
                                .LogErrors(logger)
                                .Subscribe(file =>
                                {
                                    MenuIsOpen = false;
                                    OpenFile(file);
                                });

            var selectedChange = this.WhenValueChanged(vm => vm.Selected)
                .Subscribe(selected =>
                {
                    var currentSelection = selected?.Content as ISelectedAware;

                    Views.Where(hv=> !hv.Equals(selected))
                        .Select(hv => hv.Content)
                        .OfType<ISelectedAware>()
                        .ForEach(selectedAware => selectedAware.IsSelected = false);

                    if (currentSelection != null)
                        currentSelection.IsSelected = true;
                });

            _cleanUp = new CompositeDisposable(recentFilesViewModel,
                isEmptyChecker,
                fileDropped,
                DropMonitor,
                openRecent,
                selectedChange,
                Disposable.Create(() =>
                {
                     Views.Select(vc => vc.Content)
                            .OfType<IDisposable>()
                            .ForEach(d=>d.Dispose());
                }));
        }
 public SamplesWindowViewModel()
 {
     this._samplesVM = new SamplesViewModel();
     this._allSamples = _samplesVM.AllSamples;
     this._windowFactory = new ProductionWindowFactory();
 }
示例#50
0
 public InterTabClient(IWindowFactory tradeWindowFactory)
 {
     _factory = tradeWindowFactory;
 }
示例#51
0
 protected override void SetupShared()
 {
     WindowFactory = Container.Resolve<IWindowFactory>();
 }