public ShooterCreateViewModel() { AddToAssingedParticipationCommand = new RelayCommand<ParticipationListItem>(ExecuteAddToAssignedParticipationCommand, CanExecuteAddtoAssignedParticipationCommand); RemoveFromAssingedParticipationCommand = new RelayCommand<ShooterParticipationListItem>(ExecuteRemoveFromAssignedParticipationCommand, CanExecuteRemoveFromAssignedParticipationCommand); CancelCommand = new RelayCommand<object>(ExecuteCloseCommand); CreateShooterCommand = new RelayCommand<UiPerson>(ExecuteCreateShooterCommand, CanExecuteCreateShooterCommand); if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _participationDataStore = config.GetParticipationDataStore(); _windowService = config.GetWindowService(); _shooterParticipationDataStore = config.GetShooterParticipationDataStore(); _uiEvents = config.GetUIEvents(); _uiEvents.PersonSelected += person => { UiPerson = person; }; _uiEvents.RequireSelectedPerson(); _shooterNumberService = config.GetShooterNumberService(); _shooterDataStore = config.GetShooterDataStore(); _shooterParticipationView = config.GetShooterParticipationView(); _ssvShooterDataWriterService = config.GetSsvShooterDataWriterService(); LoadAvailableParticipationList(); LoadAssignedParticipationList(); } }
/// <summary> /// Initialize properties /// </summary> public void Initialize() { Name = "Tranzakciók"; windowService = new WindowService(); // Creating Commands AddItemCommand = new RelayCommand( p => Create(), p => CanCreate()); ModifyCommand = new RelayCommand( p => Modify(), p => CanModify()); DeleteCommand = new RelayCommand( p => Delete(), p => CanModify()); SearchCommand = new RelayCommand( p => Search(null), p => CanSearch()); ResetCommand = new RelayCommand( p => ResetSearchFilter()); ImportCommand = new RelayCommand( p => ImportFromExcel()); // Initialize available categories InitializeCategories(); // Initialize the new transaction object InitializeNewTransaction(); // Set the filters to basic state and get the related transactions ResetSearchFilter(); Search(null); }
public OrderReviewViewModel(IMessageBus bus, IWindowService windowService) { Guard.NotNull(windowService, nameof(windowService)); Guard.NotNull(bus, nameof(bus)); this.bus = bus; this.windowService = windowService; }
protected CodeDocumentType(ICodeProjectService codeProjectService, IViewService viewService, CodeOptionsModel codeOptionsModel, IWindowService windowService) { this.codeProjectService = codeProjectService; this.viewService = viewService; this.codeOptionsModel = codeOptionsModel; this.windowService = windowService; }
public ParticipationCreateViewModel() { if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _participationDataStore = config.GetParticipationDataStore(); _shooterCollectionDataStore = config.GetShooterCollectionDataStore(); _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore(); _collectionShooterDataStore = config.GetCollectionShooterDataStore(); _shooterParticipationDataStore = config.GetShooterParticipationDataStore(); _shooterDataStore = config.GetShooterDataStore(); _personDataStore = config.GetPersonDataStore(); _windowService = config.GetWindowService(); _events = config.GetUIEvents(); _events.FetchSelectedParticipation += () => _selectedUiParticipation; LoadParticipations(); LoadAvailableShooters(); } OkCommand = new RelayCommand <ParticipationDraft>(ExecuteCreateParticipationCommand, CanExecuteCreateParticipationCommand); CancelCommand = new RelayCommand <object>(ExecuteCancelCommand); AssignCommand = new RelayCommand <UiShooter>(ExecuteAssignCommand, CanExecuteAssignCommand); RemoveCommand = new RelayCommand <UiShooter>(ExecuteRemoveCommand, CanExecuteRemoveCommand); DeleteCommand = new RelayCommand <UiShooterCollection>(ExecuteDeleteShooterCollectionCommand, CanExecuteDeleteShooterCollectionCommand); CreateCommand = new RelayCommand <UiParticipation>(ExecuteCreateShooterCollectionParticipation, CanExecuteShooterCollectionParticipation); }
private void WindowService_StartMoving(IWindowService sender, IntPtr args) { foreach (var(index, display) in _displays) { DisplayHelper.UpdateWorkingArea(display); } }
public ForecastViewModel(IRepository repository, IWindowService windowService) { _repository = repository; _windowService = windowService; CurrentMonthForecastAreas = new ObservableCollection <ForecastLineGroup>(); GenericForecastAreas = new ObservableCollection <ForecastLineGroup>(); }
public AddMultipleProjectsProgressViewModel( [NotNull] IWindowService windowService, [NotNull] INVsSolution solution, AddMultipleProjectsConfigurationViewModel configurationViewModel, [NotNull] SolutionItemHierarchy solutionItemHierarchy) { if (solutionItemHierarchy == null) { throw new ArgumentNullException(nameof(solutionItemHierarchy)); } _WindowService = windowService ?? throw new ArgumentNullException(nameof(windowService)); _Solution = solution ?? throw new ArgumentNullException(nameof(solution)); _ConfigurationViewModel = configurationViewModel; SolutionItemHierarchy = solutionItemHierarchy.SolutionItems; SolutionItemCount = solutionItemHierarchy.NumberOfItemsToCreate; _HasProjectAddCompleted = new ObservableProperty <bool>(this); _WasProjectAddStarted = new ObservableProperty <bool>(this); _AreThereAnyProjectsSelected = new ObservableProperty <bool>(this, solutionItemHierarchy.SolutionItems.Any()); _NumberOfCreatedProjects = new ObservableProperty <int>(this); _NumberOfCreatedSolutionFolders = new ObservableProperty <int>(this); _NumberOfCreatedSolutionItems = new ObservableProperty <int>(this); _NumberOfErrors = new ObservableProperty <int>(this); StartCommand = new DelegateCommand(Start, arg => AreThereAnyProjectsSelected); CancelCommand = new DelegateCommand(Cancel); CloseCommand = new DelegateCommand(Close, arg => HasProjectAddCompleted); GoBackToConfigurationCommand = new DelegateCommand(GoBackToConfiguration); }
public MainWindowViewModel(IWindowService windowService) { if (!WindowsHelper.IsInDesignMode) { if (windowService == null) { throw new ArgumentNullException(nameof(windowService)); } } TestCases = new List <object> { new TestWindowViewModel(windowService), new TestDialogViewModel(windowService), new TestItemConductorViewModel(windowService), new TestOneActiveItemsConductorViewModel(windowService), }; CloseCommand = new DelegateCommand(Close); if (WindowsHelper.IsInDesignMode) { DisplayName = "Main window title!"; } }
public TestDialogViewModel(IWindowService windowService) { if (!WindowsHelper.IsInDesignMode) { if (windowService == null) { throw new ArgumentNullException(nameof(windowService)); } } _windowService = windowService; DisplayName = "Test dialog"; Log = new ObservableCollection <string>(); ShowWindowCommand = new DelegateCommand(() => ShowDialog("Window")); ShowUserControlCommand = new DelegateCommand(() => ShowDialog("UserControl")); if (WindowsHelper.IsInDesignMode) { Log.Add("Log entry 1..."); Log.Add("Log entry 2..."); Log.Add("Log entry 3..."); Log.Add("Log entry 4..."); Log.Add("Log entry 5..."); } }
public ShooterEditViewModel() { AddToAssingedParticipationCommand = new RelayCommand<ParticipationListItem>(ExecuteAddToAssignedParticipationCommand, CanExecuteAddtoAssignedParticipationCommand); RemoveFromAssingedParticipationCommand = new RelayCommand<ShooterParticipationListItem>(ExecuteRemoveFromAssignedParticipationCommand, CanExecuteRemoveFromAssignedParticipationCommand); CancelCommand = new RelayCommand<object>(ExecuteCloseCommand); AssignShooterCollectionCommand = new RelayCommand<UiShooterCollection>(ExecuteAssignShooterCommand, CanExecuteAssignShooterCommand); if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _participationDataStore = config.GetParticipationDataStore(); _windowService = config.GetWindowService(); _shooterParticipationDataStore = config.GetShooterParticipationDataStore(); _collectionShooterDataStore = config.GetCollectionShooterDataStore(); _personDataStore = config.GetPersonDataStore(); _uiEvents = config.GetUIEvents(); _uiEvents.ShooterSelected += shooter => { UiShooter = shooter; }; _uiEvents.RequireSelectedShooter(); _shooterNumberService = config.GetShooterNumberService(); _shooterDataStore = config.GetShooterDataStore(); _shooterParticipationView = config.GetShooterParticipationView(); _shooterCollectionDataStore = config.GetShooterCollectionDataStore(); _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore(); LoadData(); UiShooterCollections = new ObservableCollection<UiShooterCollection>(_shooterCollectionDataStore.GetAll().Select(UiBusinessObjectMapper.ToUiShooterCollection).OrderBy(_ => _.CollectionName)); } }
public MainViewModel( IDragDropService dragDropService, IBackupFileService backupFileService, IWindowService windowService, IFileOpenSaveService fileOpenSaveService, IDialogService dialogService) { _dragDropService = dragDropService; _backupFileService = backupFileService; _windowService = windowService; _fileOpenSaveService = fileOpenSaveService; _dialogService = dialogService; Files.CollectionChanged += FilesCollectionChanged; SetTitle(); // subscriptions... Messenger.Default.Register <DragOverMessage>(this, OnDragOver); Messenger.Default.Register <DragDropMessage>(this, OnDragDrop); Messenger.Default.Register <MainWindowClosingMessage>(this, OnMainWindowClosing); Messenger.Default.Register <NotesRedactedMessage>(this, OnNotesRedacted); AddDesignTimeItems(); InitCommands(); GetVersionData(); }
protected override void OnStartup() { // Mandatory services. _windowService = Editor.Services.GetInstance <IWindowService>().ThrowIfMissing(); _statusService = Editor.Services.GetInstance <IStatusService>().ThrowIfMissing(); // Optional services. _searchService = Editor.Services.GetInstance <ISearchService>().WarnIfMissing(); // Add the command items and register menus, toolbars, and context menus. AddDataTemplates(); AddCommands(); AddMenus(); AddToolBars(); AddContextMenu(); AddSearchScopes(); // Load the list of recently used files. LoadRecentFiles(); // Monitor editor. Editor.Activated += OnEditorActivated; // This calls AddCommandBindings. Editor.Deactivated += OnEditorDeactivated; Editor.UIInvalidated += OnEditorUIInvalidated; Editor.ActiveDockTabItemChanged += OnActiveDockTabItemChanged; Editor.WindowActivated += OnEditorWindowActivated; }
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); }
public WindowWrapper(IWindowService windowFactory, IWindow window, IViewModelWindow datacontext) { this.windowFactory = windowFactory; this.window = window; this.window.DataContext = datacontext; DataContext = datacontext; }
public PopUp(IWindowService openWindowService) { GetTermTranslationList(StaticConfigProvider.CurrentCategoryPath); GetWordsDictionary(); IsTestOn = StaticConfigProvider.IsTestOn; IsTestOpenFirstly = StaticConfigProvider.IsTestOpenFirstly; //IsTestOpenFirstly = true; TermCounter = 0; TranslationCounter = 0; TermListCount = TermList.Count; TranslationListCount = TranslationList.Count; if (IsTestOn && !IsTestOpenFirstly) { GetCurrentWordsDictionary(10); FillCurrentTermTranslationLists(CurrentWordsDictionary); } else if (IsTestOn && IsTestOpenFirstly) { CurrentWordsDictionary = new Dictionary <string, double>(); //GetCurrentWordsDictionary(10); FillCurrentTermTranslationLists(CurrentWordsDictionary); } this.openWindowService = openWindowService; StaticConfigProvider.StaticPropertyChanged += StaticConfigProvider_PropertyChanged; }
public TestWindowViewModel(IWindowService windowService) { if (!WindowsHelper.IsInDesignMode) { if (windowService == null) { throw new ArgumentNullException(nameof(windowService)); } } _windowService = windowService; DisplayName = "Test window"; Log = new ObservableCollection <string>(); ShowWindowCommand = new DelegateCommand(ShowWindow, CanShowWindow); HideWindowCommand = new DelegateCommand(HideWindow, CanHideWindow); CloseWindowCommand = new DelegateCommand(CloseWindow, CanCloseWindow); if (WindowsHelper.IsInDesignMode) { Log.Add("Log entry 1..."); Log.Add("Log entry 2..."); Log.Add("Log entry 3..."); Log.Add("Log entry 4..."); Log.Add("Log entry 5..."); } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> /// <param name="windowService"> /// The window service /// </param> /// <param name="addinService"> /// The add-in service /// </param> /// <param name="settingsService"> /// The settings service /// </param> public MainViewModel(IWindowService windowService, IAddinService addinService, ISettingsService settingsService) { this.windowService = windowService; var projects = settingsService.GetProjects(); var projectModel = projects.FirstOrDefault(); var tt = addinService.TaskTrackers.First(); var qs = tt.GenerateQuerySettings(); if (!projects.Any()) { projectModel = new ProjectModel("Demo project", tt.Id); var ss = new SecureString(); ss.AppendChar('H'); ss.AppendChar('e'); ss.AppendChar('l'); ss.AppendChar('l'); ss.AppendChar('o'); var testSettings = new Dictionary<string, SecureString> { { "SomeKey1", ss }, { "SomeKey2", ss } }; var projectSettings1 = new SettingsModel(projectModel.InternalUrn, testSettings); settingsService.SaveProject(projectModel, projectSettings1); } var projectSettings2 = settingsService.GetProjectSettings(projectModel); this.Tasks = new ObservableCollection<ITaskModel>(tt.GetAssignedToUser(projectModel, projectSettings2)); settingsService.SaveProject(projectModel); }
public GameTableContext(uint size, IWindowService service) { //_BackgroundImage = new BitmapImage(new Uri("Images//sea_field.png")); _TableSize = (int)size; GameController.Instance.Init(size, 9, new[] { new Player("Gipsz Jakab", PlayerColor.Blue), new Player("Játékos 2", PlayerColor.Red) }); if (service == null) throw new ArgumentNullException("service"); Messages = new Queue<MessageContext>(); WindowService = service; NewGameContext = new NewGameContext(this, new[] { new Player("1. játékos", PlayerColor.Blue), new Player("2. játékos", PlayerColor.Red), new Player("3. játékos", PlayerColor.Orange), new Player("4. játékos", PlayerColor.Green), }); NewGameContext.Closed += (sender, args) => { var context = sender as NewGameContext; if (context != null) { if (context.IsNewGame) InitializeGame(context); } }; }
public RoleViewModel(IRoleService roleService, IWindowService windowService, IModalsService modalsService, ITranslationService translationService) : base(translationService) { _roleService = roleService; _windowService = windowService; _modalsService = modalsService; }
/// <summary> /// Initializes a new instance of the <see cref="OpService" /> class. /// </summary> public OpService(IWindowService windowService) : base("op") { this.Documents = new Dictionary<string, DocumentModel>(); this.ViewModel = new CollaborationsViewModel(); this.WindowService = windowService; }
public HomeViewModel(IWindowService windowService) { _windowService = windowService; AddFieldCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(this.ExecuteAddFieldCommand); OpenFieldCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(this.ExecuteOpenFieldCommand); ShutdownCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(this.ExecuteShutdownCommand); SyncCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(this.ExecuteSyncCommand); DeleteCheckedCommand = new GalaSoft.MvvmLight.CommandWpf.RelayCommand(this.ExecuteDeleteCheckedCommand); Producers = new ObservableCollection <ComboBoxItemViewModel>(); Farms = new ObservableCollection <FarmComboBoxItemViewModel>(); Fields = new ObservableCollection <FieldComboBoxItemViewModel>(); Lists = new ObservableCollection <PickupListGridItem>(); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <PickupListAddedMessage>(this, action => ProcessListAddedMessage(action)); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <TagLoadingMessage>(this, action => ProcessTagLoadingMessage(action)); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <TagUnloadingMessage>(this, action => ProcessTagUnloadingMessage(action)); GalaSoft.MvvmLight.Messaging.Messenger.Default.Register <DataRefreshedMessage>(this, action => ProcessDataRefreshedMessage(action)); Messenger.Default.Register <AllAggEventsProcessComplete>(this, (action) => ProcessLoadUnloadComplete(action)); refresh(); SelectedProducer = Producers[0]; SelectedFarm = Farms[0]; SelectedField = Fields[0]; if (Lists.Count() > 0) { SelectedItem = Lists[0]; } /*Timer timer = new Timer(30000); * timer.Elapsed += (sender, e) => HandleTimer(); * timer.Start();*/ }
public DBCleanerWindow(IRepository repository, IWindowService windowService) { InitializeComponent(); this.repository = repository; this.windowService = windowService; }
//-------------------------------------------------------------- #region Creation & Cleanup //-------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="TextDocumentViewModel"/> class. /// </summary> /// <param name="document">The document.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="document"/> is <see langword="null"/>. /// </exception> public TextDocumentViewModel(TextDocument document) : base(document) { if (document == null) { throw new ArgumentNullException(nameof(document)); } var editor = document.Editor; // Mandatory services. _textService = editor.Services.GetInstance <ITextService>().ThrowIfMissing(); _windowService = editor.Services.GetInstance <IWindowService>().ThrowIfMissing(); // Optional services. _searchService = editor.Services.GetInstance <ISearchService>().WarnIfMissing(); _highlightingService = editor.Services.GetInstance <IHighlightingService>().WarnIfMissing(); _textContextMenu = _textService.ContextMenu; PrintPreviewCommand = new DelegateCommand(ShowPrintPreview); PrintCommand = new DelegateCommand(Print); FindCommand = new DelegateCommand(Find, CanFind); FindAndReplaceCommand = new DelegateCommand(FindAndReplace); CancelCommand = new DelegateCommand(Cancel); }
public DisplayService(IWindowService windowService) { _windowService = windowService; UpdateDisplays(); Subscribe(); }
public MainWindowModel(PopUp model, IConfigProvider configProvider, IWindowService openWindowService) { Model = model; Model.PropertyChanged += Model_PropertyChanged; CurrentCategory = StaticConfigProvider.CurrentCategoryPath.Remove(0, 8); DataGridItemList = new ObservableCollection <DataGridItem>(); DataGridWordsDictionary = new Dictionary <string, double>(); DataGridTermTranslationList = Model.TermTranslationList; DataGridTermList = new List <string>(); DataGridTranslationList = new List <string>(); StringSlicer(); for (int i = 0; i < DataGridTermList.Count; i++) { if (DataGridTermList[i].Length != 0) { DataGridItem dgi = new DataGridItem { Term = DataGridTermList[i].Remove(DataGridTermList[i].Length - 1), Translation = DataGridTranslationList[i] }; DataGridItemList.Add(dgi); } } this.configProvider = configProvider; this.openWindowService = openWindowService; TreeViewItemsList = GetItems("English"); //OpenPopUpWindowCommand = new RelayCommand(OpenPopUpWindowCommand_Execute); OpenTermFontDialogCommand = new RelayCommand(OpenTermFontDialogCommand_Execute); OpenTranslationFontDialogCommand = new RelayCommand(OpenTranslationFontDialogCommand_Execute); SelectedItemChangedCommand = new RelayCommand(SelectedItemChangedCommand_Execute); OpenTestWindowCommand = new RelayCommand(OpenTestWindowCommand_Execute); }
public EditPassViewModel() { if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _shooterDatastore = config.GetShooterDataStore(); _sessionDatastore = config.GetSessionDataStore(); _programItemDatastore = config.GetProgramItemDataStore(); _personDatastore = config.GetPersonDataStore(); _windowService = config.GetWindowService(); _events = config.GetUIEvents(); List<UiShooter> shooters = _shooterDatastore.GetAll().Select(UiBusinessObjectMapper.ToUiShooter).ToList(); shooters.ForEach(_ => { if (_.PersonId != null) _.FetchPerson(_personDatastore.FindById((int) _.PersonId)); }); UiShooters = new ObservableCollection<UiShooter>(shooters.OrderBy(_ => _.LastName).ThenBy(_ => _.FirstName)); SearchShooterCommand = new RelayCommand<string>(ExecuteSearchShooterCommand, CanExecuteSearchShooterCommand); DeleteCommand = new RelayCommand<UiSession>(ExecuteDeleteCommand, CanExecuteDeleteCommand); CancelCommand = new RelayCommand<object>(ExecuteCancelCommand); SaveCommand = new RelayCommand<UiShooter>(ExecuteSaveCommand, CanExecuteSaveCommand); UiShooter selectedUiShooter = _events.FetchSelectedShooter(); if (selectedUiShooter != null) { ShooterNumber = string.Format("{0}", selectedUiShooter.ShooterNumber); ExecuteSearchShooterCommand(ShooterNumber); } } }
public ShooterEditViewModel() { AddToAssingedParticipationCommand = new RelayCommand <ParticipationListItem>(ExecuteAddToAssignedParticipationCommand, CanExecuteAddtoAssignedParticipationCommand); RemoveFromAssingedParticipationCommand = new RelayCommand <ShooterParticipationListItem>(ExecuteRemoveFromAssignedParticipationCommand, CanExecuteRemoveFromAssignedParticipationCommand); CancelCommand = new RelayCommand <object>(ExecuteCloseCommand); AssignShooterCollectionCommand = new RelayCommand <UiShooterCollection>(ExecuteAssignShooterCommand, CanExecuteAssignShooterCommand); if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _participationDataStore = config.GetParticipationDataStore(); _windowService = config.GetWindowService(); _shooterParticipationDataStore = config.GetShooterParticipationDataStore(); _collectionShooterDataStore = config.GetCollectionShooterDataStore(); _personDataStore = config.GetPersonDataStore(); _uiEvents = config.GetUIEvents(); _uiEvents.ShooterSelected += shooter => { UiShooter = shooter; }; _uiEvents.RequireSelectedShooter(); _shooterNumberService = config.GetShooterNumberService(); _shooterDataStore = config.GetShooterDataStore(); _shooterParticipationView = config.GetShooterParticipationView(); _shooterCollectionDataStore = config.GetShooterCollectionDataStore(); _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore(); LoadData(); UiShooterCollections = new ObservableCollection <UiShooterCollection>(_shooterCollectionDataStore.GetAll().Select(UiBusinessObjectMapper.ToUiShooterCollection).OrderBy(_ => _.CollectionName)); } }
private void WindowObserver_Moving(IWindowService windowService, IntPtr windowHandle) { if (!UpdateContext()) { return; } var rule = _context.Rules.FirstOrDefault(x => x.Trigger.Check(_context)); if (rule != null) { try { var action = rule.Action as PlacementAction; var executor = _actionExecutorFactory.Create(action); _previewRenderer.RenderPlacement(action.Placement, _context); } catch (Exception e) { // TODO: Handle exceptions _previewRenderer.ClearPlacement(); return; } } else { _previewRenderer.ClearPlacement(); } }
public LookupTableViewModel(ILookupTableView view, IWindowService win, IProjectService prj, IShellService shell) : base(view) { _WindowService = win; _ProjectService = prj; _ShellService = shell; }
public FlyerMakerViewModel(List<Material> materials, int selectedMateriaId, Func<string, FontInfo> getFont, IFontService fontService, IWindowService windowService) : base(materials, getFont, fontService, windowService) { SetMaterials(materials, selectedMateriaId, fontService); LayoutMode = false; }
protected SessionViewModelBase(IRepository repository, IWindowService windowService, ShortcutService shortcutService, IStatusService statusService) { Repository = repository; WindowService = windowService; ShortcutService = shortcutService; StatusService = statusService; }
public MainWindowViewModel(IGoalTrackerService gtService, IWindowService windowService, DateTime displayDate) { this.gtService = gtService; this.windowService = windowService; PreviousMonthCommand = new DelegateCommand(SwitchToPreviousMonth); NextMonthCommand = new DelegateCommand(SwitchToNextMonth); NewFileCommand = new DelegateCommand(NewFile); LoadFileCommand = new DelegateCommand(LoadFile); MoveFileCommand = new DelegateCommand(MoveFile, IsSaveDataLoaded); ShowFilePathCommand = new DelegateCommand(RequestShowSaveFilePath); AddGoalCommand = new DelegateCommand(AddGoal, IsSaveDataLoaded); RemoveGoalCommand = new DelegateCommand(RemoveGoal, IsSaveDataLoaded); ShowEditorCommand = new DelegateCommand(ShowSkinEditor, () => !IsEditorOpen); ChangeSkinCommand = new DelegateCommand <string>(skinName => RequestChangeSkin?.Invoke(skinName), x => !IsEditorOpen); CloseCommand = new DelegateCommand(() => RequestClose?.Invoke()); DisplayMonth = displayDate; PopulateCalendarDaysAndWeeks(); }
public SettingsPasswordViewModel(IWindowService windowService, IAppSettingsService settingsService, Mediator mediator) : base(settingsService, mediator) { this.windowService = windowService; }
/// <inheritdoc/> protected override void OnShutdown() { // Stop monitoring editor. Editor.Activated -= OnEditorActivated; Editor.Deactivated -= OnEditorDeactivated; Editor.UIInvalidated -= OnEditorUIInvalidated; Editor.ActiveDockTabItemChanged -= OnActiveDockTabItemChanged; Editor.WindowActivated -= OnEditorWindowActivated; RemoveSearchScopes(); RemoveCommandBindings(); RemoveContextMenu(); RemoveToolBars(); RemoveMenus(); RemoveCommands(); RemoveDataTemplates(); // Store the list of recently used files. SaveRecentFiles(); // Clear services. _windowService = null; _statusService = null; _searchService = null; }
static void VerifyService(IWindowService service) { if (service == null) { throw new ArgumentNullException("service"); } }
public DefaultConfiguration() { //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log"); //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Documents\My Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20140516_164043.log"); //_shootingRange = new SiusDataFileProvider(@"C:\Users\eberlid\Dropbox\SSC\2014\Herbstschiessen\ShootingRange\20130914_132912.log"); //_shootingRange = new SiusApiProvider("http://192.168.1.4"); _shootingRange = new SiusDataSocketProvider("127.0.0.1", 4000); _events = new ShootingRangeEvents(); _uiEvents = new UIEvents(); ShootingRangeEntities entities = new ShootingRangeEntities(); _personRepository = new PersonDataStore(entities); _shooterRepository = new ShooterDataStore(entities); _participationDataStore = new ParticipationDataStore(entities); _sessionDataStore = new SessionDataStore(entities); _shotDataStore = new ShotDataStore(entities); _sessionDetailsView = new SessionDetailsView(entities); _shooterNumberConfigDataStore = new ShooterNumberConfigDataStore(entities); _shooterParticipationDataStore = new ShooterParticipationDataStore(entities); _sessionSubtotalDataStore = new SessionSubtotalDataStore(entities); _programItemDataStore = new ProgramItemDataStore(entities); _groupMemberDetailsView = new GroupMemberDetailsView(entities); _groupDetailsView = new GroupDetailsView(entities); _shooterParticipationView = new ShooterParticipationView(entities); _windowService = new WindowService(); _barcodePrintService = new PtouchBarcodePrinter(); _barcodeBuilderService = new Barcode2Of5InterleavedService(); _shooterNumberService = new ShooterNumberService(_shooterNumberConfigDataStore); _shooterCollectionParticipationDataStore = new ShooterCollectionParticipationDataStore(entities); _shooterCollectionDataStore = new ShooterCollectionDataStore(entities); _collectionShooterDataStore = new CollectionShooterDataStore(entities); _ssvShooterDataWriterService = new SsvFileWriter(@"C:\Sius\SiusData\SSVDaten\SSV_schuetzen.txt"); }
public SwitchToDialog(IWindowService windowService, IViewService viewService) { FrameworkElement element = FileTable.GetElement("Resources\\UserInterface\\SwitchToDialog.xaml"); element.DataContext = (object)this; this.DialogContent = (UIElement)element; this.Title = StringTable.SwitchToDialogTitle; this.SizeToContent = SizeToContent.WidthAndHeight; this.WindowStyle = WindowStyle.None; this.documentListBox = element.FindName("DocumentList") as ListBox; this.windowService = windowService; this.viewService = viewService; this.documentViewReferences = new ObservableCollection <DocumentViewReference>(); foreach (IView view in (IEnumerable <IView>) this.viewService.Views) { IDocumentView documentView = view as IDocumentView; if (documentView != null) { this.documentViewReferences.Add(new DocumentViewReference(documentView)); } } this.documentViewReferencesView = CollectionViewSource.GetDefaultView((object)this.documentViewReferences); this.documentViewReferencesView.MoveCurrentToFirst(); this.MoveSelectionByOne(true); }
public ParticipationCreateViewModel() { if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _participationDataStore = config.GetParticipationDataStore(); _shooterCollectionDataStore = config.GetShooterCollectionDataStore(); _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore(); _collectionShooterDataStore = config.GetCollectionShooterDataStore(); _shooterParticipationDataStore = config.GetShooterParticipationDataStore(); _shooterDataStore = config.GetShooterDataStore(); _personDataStore = config.GetPersonDataStore(); _windowService = config.GetWindowService(); _events = config.GetUIEvents(); _events.FetchSelectedParticipation += () => _selectedUiParticipation; LoadParticipations(); LoadAvailableShooters(); } OkCommand = new RelayCommand<ParticipationDraft>(ExecuteCreateParticipationCommand, CanExecuteCreateParticipationCommand); CancelCommand = new RelayCommand<object>(ExecuteCancelCommand); AssignCommand = new RelayCommand<UiShooter>(ExecuteAssignCommand, CanExecuteAssignCommand); RemoveCommand = new RelayCommand<UiShooter>(ExecuteRemoveCommand, CanExecuteRemoveCommand); DeleteCommand = new RelayCommand<UiShooterCollection>(ExecuteDeleteShooterCollectionCommand, CanExecuteDeleteShooterCollectionCommand); CreateCommand = new RelayCommand<UiParticipation>(ExecuteCreateShooterCollectionParticipation, CanExecuteShooterCollectionParticipation); }
public MainViewModel() { if (DesignTimeHelper.IsInDesignMode) { _personDataStore = new FakePersonDataStore(); _shooterDataStore = new FakeShooterDataStore(); _participationDataStore = new FakeParticipationDataStore(); _groupMemberDetailsView = new FakeGroupMemberDetailsView(); _groupDetailsView = new FakeGroupDetailsView(); } else { IConfiguration config = ConfigurationSource.Configuration; _personDataStore = config.GetPersonDataStore(); _shooterDataStore = config.GetShooterDataStore(); _participationDataStore = config.GetParticipationDataStore(); _shooterParticipationDataStore = config.GetShooterParticipationDataStore(); _groupMemberDetailsView = config.GetGroupMemberDetailsView(); _shooterParticipationView = config.GetShooterParticipationView(); _groupDetailsView = config.GetGroupDetailsView(); _sessionDetailsView = config.GetSessionDetailsView(); _shooterDataWriterService = config.GetSsvShooterDataWriterService(); _collectionShooterDataStore = config.GetCollectionShooterDataStore(); _shooterCollectionDataStore = config.GetShooterCollectionDataStore(); _shooterCollectionParticipationDataStore = config.GetShooterCollectionParticipationDataStore(); _shooterNumberService = config.GetShooterNumberService(); _windowService = config.GetWindowService(); _barcodePrintService = config.GetBarcodePrintService(); _barcodeBuilderService = config.GetBarcodeBuilderService(); _events = config.GetEvents(); _uiEvents = config.GetUIEvents(); _uiEvents.RequireSelectedPerson += () => _uiEvents.PersonSelected(SelectedUiPerson); _uiEvents.SelectPersonById += (id) => { SelectedUiPerson = UiPeople.FirstOrDefault(_ => _.PersonId == id); }; _uiEvents.RequireSelectedShooter += () => _uiEvents.ShooterSelected(SelectedUiShooter); _uiEvents.FetchSelectedShooter += () => SelectedUiShooter; _uiEvents.PersonDataStoreChanged += LoadPersonList; _uiEvents.ShooterDataStoreChanged += LoadShooterList; _shooterNumberService.Configure(_shooterDataStore); LoadPersonList(); LoadShooterList(); LoadParticipationList(); } CreatePersonCommand = new RelayCommand<object>(ExecuteCreatePersonCommand); EditPersonCommand = new RelayCommand<UiPerson>(ExecuteEditPersonCommand, CanExecuteEditPersonCommand); DeletePersonCommand = new RelayCommand<UiPerson>(ExecuteDeletePersonCommand, CanExecuteDeletePersonCommand); CreateShooterCommand = new RelayCommand<UiPerson>(ExecuteCreateShooterCommand, CanExecuteCreateShooterCommand); EditShooterCommand = new RelayCommand<UiShooter>(ExecuteEditShooterCommand, CanExecuteEditShooterCommand); DeleteShooterCommand = new RelayCommand<UiShooter>(ExecuteDeleteShooterCommand, CanExecuteDeleteShooterCommand); CreateParticipationCommand = new RelayCommand<object>(ExecuteCreateParticipationCommand); //EditParticipationCommand = new RelayCommand<UiParticipation> //DeleteParticipationCommand = new RelayCommand<UiParticipation> PrintBarcodeCommand = new RelayCommand<UiShooter>(ExecutePrintBarcodeCommand, CanExecutePrintBarcodeCommand); EditPassCommand = new RelayCommand<SessionDetails>(ExecuteEditPassCommand); }
/// <summary> /// Initialises a new instance of the <see cref="MainDesktopViewModel"/> class. /// </summary> /// <param name="windowService">The platform's window service.</param> public MainDesktopViewModel(IWindowService windowService) { this.windowService = windowService; this.AddAccountCommand = new RelayCommand(() => this.AddAccount()); this.RenameAccountCommand = new RelayCommand(() => this.RenameAccount()); this.BootstrapDomain(); var accountListRepo = ApplicationCore.Core.Default.Repositories.AccountListReadModelRepository; this.accountList = accountListRepo.Find(); }
/// <summary> /// Initializes a new instance of the <see cref="ChatService" /> class. /// </summary> public ChatService( IWindowService windowService, Preferences preferences) : base("chat") { this.ViewModels = new Dictionary<string, ChatViewModel>(); this.WindowService = windowService; this.Preferences = preferences; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IWindowService windowService, INotificationService notificationService) { _windowService = windowService; _windowService.OnCanOpenWindowChanged += WindowService_OnCanOpenWindowChanged; LoadingVisibility = Visibility.Hidden; OpenEditorCommand = new RelayCommand(OnOpenEditor, CanOpenEditor); OpenGameCommand = new RelayCommand(OnOpenGame, CanOpenGame); }
protected FlyerMakerViewModelBase(List<Material> materials, Func<string, FontInfo> getFont, IFontService fontService, IWindowService windowService) { this.fontService = fontService; FontHelper.UpdateFonts(materials, getFont, this.fontService); this.windowService = windowService; SelectedMaterialProvider = new SelectedMaterialProvider(); SelectedMaterialProvider.PropertyChanged += (s, e) => OnPropertyChanged("CanCreate"); }
public AdminViewModel(List<Material> materials, Func<string, FontInfo> getFont, IFontService fontService, IWindowService windowService) : base(materials, getFont, fontService, windowService) { Materials = materials.Select(m => m.ToMaterialModel(fontService)).ToList(); Materials.Insert(0, CreateEmptyMaterialTemplate(fontService)); ViewState = ViewStates.SelectTemplate; LayoutMode = true; FlyerViewModel.CanAddLogo = false; }
public SettingWindowViewModel(IWindowService windowService, ISettings settings) : base(windowService) { if (windowService == null) throw new ArgumentNullException("windowService"); if(settings == null) throw new ArgumentNullException("settings"); this.settings = settings; this.ServerName = this.settings.ServerName; this.ServerPort = this.settings.ServerPort; }
public DocumentViewModel(IWindowService windowService) { if (!WindowsHelper.IsInDesignMode) if (windowService == null) throw new ArgumentNullException(nameof(windowService)); _windowService = windowService; // Use DisplayName to store document title. DisplayName = "Document" + _count; _text = "This is " + DisplayName + "."; _count++; }
void InitResourcePaneHook(IWindowService windowService) { var resourcePalette = windowService.PaletteRegistry.PaletteRegistryEntries.FirstOrDefault(p => p.Name == "Designer_ResourcePane"); if (resourcePalette == null) return; var resourcePane = resourcePalette.Content as ResourcePane; if (resourcePane == null) return; _resourceContainers = resourcePane.ResourceContainers as ObservableCollectionAggregator; if (_resourceContainers == null) return; _resourceContainers.CollectionChanged += ResourceListChangedEventHandler; }
public ComponentTitleViewModel(string title, IWindowService windowService) { if (windowService == null) throw new ArgumentNullException(nameof(windowService)); _title = title; _oldTitle = title; _windowService = windowService; ConfirmCommand = new RelayCommand(ExecuteConfirmCommand, CanCloseDialog); CancelCommand = new RelayCommand(ExecuteCancelCommand); this.ForProperty(nameof(Title)) .Subscribe(() => { ConfirmCommand.RaiseCanExecuteChanged(); }); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> /// <param name="model"> /// The model /// </param> /// <param name="windowService"> /// The window service /// </param> /// <param name="messageboxService"> /// The message box service /// </param> public MainViewModel(object model, IWindowService windowService, IMessageboxService messageboxService) { this.windowService = windowService; this.messageboxService = messageboxService; this.model = (SampleModel)model; //// You may expect this to cause a memory leak, without un-registering, but as the Window is closed the entire View Model is automatically unregistered from the Messenger. //// You could, of course use this.MessengerInstance.UnRegister() if you needed to do this prematurely for some reason. //// //// Note: If this View Model is bound to a view other than a WindowView, cleanup will NOT automatically be called when the window is closed; you will have to make you own arrangements. //// Personally, I would recommend that if this VM is embedded in a VM that is bound to a PageView, you let the parent view model handle message registrations and pass the actions onto the //// child VM by exposing methods. That way, you leverage the automatic clean up that you get for free, and the reduce the risk of leaving an unexpected message registration behind for the lifetime of the app. this.MessengerInstance.Register<ShowTextMessage>(this, m => { this.DemoText = m.Text; }); this.DemoText = "This text is bound to a property on the view model, when you click the button the view model will change the value using the Set() method. This will automatically call RaisePropertyChanged on the property and cause the UI to update."; }
public TestItemConductorViewModel(IWindowService windowService) { if (!WindowsHelper.IsInDesignMode) if (windowService == null) throw new ArgumentNullException(nameof(windowService)); _windowService = windowService; DisplayName = "Test ItemConductor"; NewCommand = new DelegateCommand(New); CloseCommand = new DelegateCommand(Close); if (WindowsHelper.IsInDesignMode) { ActivateItemAsync(DocumentViewModel.DesignInstance).Wait(); } }
/// <inheritdoc/> protected override void OnStartup() { _windowService = Editor.Services.GetInstance<IWindowService>().ThrowIfMissing(); AddDataTemplates(); AddCommands(); AddMenus(); //AddToolBars(); AddDockContextMenu(); AddCaptionBarItems(); InitializeLayouts(); // Call LoadDockControlLayout when editor is activated. We cannot call it right now // because some extensions include their dock windows, which are not initialized yet. Editor.Activated += OnEditorActivated; }
public LoginWindowViewModel(IViewModelFactory viewModelFactory, IWindowService windowService, ISettings settings, IConnection connection) : base(windowService) { if (viewModelFactory == null) throw new ArgumentNullException("viewModelFactory"); if (windowService == null) throw new ArgumentNullException("windowService"); if (settings == null) throw new ArgumentNullException("settings"); if (connection == null) throw new ArgumentNullException("connection"); this.viewModelFactory = viewModelFactory; this.settings = settings; this.connection = connection; }
public PersonEditViewModel() { EditPersonCommand = new RelayCommand<UiPerson>(ExecuteEditPersonCommand, CanExecuteEditPersonCommand); CancelCommand = new RelayCommand<object>(ExecuteCloseCommand); //CreateShooterCommand = new RelayCommand<UiPerson>(ExecuteCreateShooterCommand, CanExecuteCreateShooterCommand); if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _personDataStore = config.GetPersonDataStore(); _shooterDataStore = config.GetShooterDataStore(); _uiEvents = config.GetUIEvents(); _windowService = config.GetWindowService(); _shooterNumberService = config.GetShooterNumberService(); _uiEvents.PersonSelected += person => { UiPerson = person ?? new UiPerson(); }; _uiEvents.RequireSelectedPerson(); } }
public MainContentViewModel(IWindowService windowService, ITranslationService translationService) { if (windowService == null) throw new ArgumentNullException(nameof(windowService)); if (translationService == null) throw new ArgumentNullException(nameof(translationService)); _windowService = windowService; _translationService = translationService; _project = new Project(); _project.CreateDocument("Document"); MessengerInstance.Register<NotificationMessageAction<string>>(this, Tokens.NewComponent, m => OpenNewComponentDialog(m.Notification, m.Execute)); MessengerInstance.Register<GenericMessage<string>>(this, Tokens.Translation, m => { var result = _translationService.TranslateToBraille(m.Content); _project.CurrentDocument.FlowDocument.Preview = result; }); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> /// public HomeworkViewModel(IHomeworkRepository homeworkRepo, IWindowService windowService) { IsEditOpen = Visibility.Hidden; currentIndex = 0; this.homeworkRepo = homeworkRepo; this.windowService = windowService; this.windowService.OnCanOpenWindowChanged += WindowService_OnCanOpenWindowChanged; HomeworkList = new ObservableCollection<Homework>(homeworkRepo.GetHomework()); EditHomeworkCommand = new RelayCommand<Guid>(EditHomeWorkHandler); DeleteHomeworkCommand = new RelayCommand<Guid>(DeleteHomeWorkHandler); SaveHomeworkCommand = new RelayCommand(SaveHomeworkHandler, CanSaveHomework); CreateHomeworkCommand = new RelayCommand(CreateHomeworkHandler); ShowBrowseCommand = new RelayCommand(ShowBrowseHandler, CanShowBrowse); GotoNextHomeworkCommand = new RelayCommand(GotoNextHomeworkHandler, CanGotoNextHomework); GotoPreviousHomeworkCommand = new RelayCommand(GotoPreviousHomeworkHandler, CanGotoPreviousHomework); }
public PersonCreateViewModel() { CreatePersonCommand = new RelayCommand<UiPerson>(ExecuteCreatePersonCommand, CanExecuteCreatePersonCommand); CancelCommand = new RelayCommand<object>(ExecuteCloseCommand); //CreateShooterCommand = new RelayCommand<UiPerson>(ExecuteCreateShooterCommand, CanExecuteCreateShooterCommand); //InscribeCompetitionCommand = new RelayCommand<UiShooter>(ExecuteInscribeCompetitionCommand, CanExecuteInscribeCompoetitionCommand); if (!DesignTimeHelper.IsInDesignMode) { IConfiguration config = ConfigurationSource.Configuration; _personDataStore = config.GetPersonDataStore(); _shooterDataStore = config.GetShooterDataStore(); _uiEvents = config.GetUIEvents(); _windowService = config.GetWindowService(); //_shooterNumberService = config.GetShooterNumberService(); } UiPerson = new UiPerson(); }
public TestDialogViewModel(IWindowService windowService) { if (!WindowsHelper.IsInDesignMode) if (windowService == null) throw new ArgumentNullException(nameof(windowService)); _windowService = windowService; DisplayName = "Test dialog"; Log = new ObservableCollection<string>(); ShowWindowCommand = new DelegateCommand(() => ShowDialog("Window")); ShowUserControlCommand = new DelegateCommand(() => ShowDialog("UserControl")); if (WindowsHelper.IsInDesignMode) { Log.Add("Log entry 1..."); Log.Add("Log entry 2..."); Log.Add("Log entry 3..."); Log.Add("Log entry 4..."); Log.Add("Log entry 5..."); } }
public MainWindowViewModel(IWindowService windowService) { if (!WindowsHelper.IsInDesignMode) if (windowService == null) throw new ArgumentNullException(nameof(windowService)); TestCases = new List<object> { new TestWindowViewModel(windowService), new TestDialogViewModel(windowService), new TestItemConductorViewModel(windowService), new TestOneActiveItemsConductorViewModel(windowService), }; CloseCommand = new DelegateCommand(Close); if (WindowsHelper.IsInDesignMode) { DisplayName = "Main window title!"; } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IDataService dataService, IWindowService windowService) { _dataService = dataService; _windowService = windowService; Headers = new List<Header>(); Meals = new List<Meal>(); OrderItems = new ObservableCollection<OrderItem>(); if (IsInDesignMode) { var orderItem = new OrderItem { Description = "Meal Description", Price = 10.95M, Notes = "These are meal notes" }; OrderItems.Add(orderItem); var header = new Header {Title = "Starters"}; Headers.Add(header); var meal = new Meal { Price = 5m, ChickenPrice = 5m, KingPrawnPrice = 5m, LambPrice = 5m, PrawnPrice = 5m, VegetablePrice = 5m, Title = "This is a meal" }; Meals.Add(meal); OrderNumber = "A0001"; Address = "David McCallum" + Environment.NewLine + "10 Bingham Broadway" + Environment.NewLine + "EH15 3JL" + Environment.NewLine + "07757 438 032"; } OrderNumber = "A0001"; Address = "David McCallum" + Environment.NewLine + "10 Bingham Broadway" + Environment.NewLine + "EH15 3JL" + Environment.NewLine + "07757 438 032"; OrderItems.CollectionChanged += UpdateTotals; }