public AddFolderPathVM(IWinSimple win) { _callingWin = win; CommandExit = new CommandRelay(commandExitExecute, p => true); CommandSave = new CommandRelay(commandSaveExecute, commandSaveCanExecute); CommandAdd = new CommandRelay(commandAddExecute, commandAddCanExecute); CommandRemove = new CommandRelay(commandRemoveExecute, commandRemoveCanExecute); CommandSelectFolder = new CommandRelay(commandSelectFolderExecute, p => true); string path = Constants.FOLDERS_FILE_PATH; IList <PathItem> folders = null; ; try { folders = DataService.ParseFolderFile(path); } catch (Exception ex) { string message = String.Format((string)Resources.GlobalHelper_ParseFolderFile_Error_Text, path, ex.Message); MessageBox.Show(message, Resources.GlobalHelper_ParseFolderFile_Error_Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); } _pathList = folders != null ? new ObservableCollection <PathItem>(folders) : new ObservableCollection <PathItem>(); ListChanged = false; }
/// <summary> /// Constructor /// </summary> public ManageTextMarkersViewModel(LogAnalysis analysis) { _analysis = analysis; _textMarkerVmList = new ObservableCollection <TextMarkerViewModel>(); CommandUpdateTextMarkers = new CommandRelay(CommandUpdateTextMarkersExecute, CommandUpdateTextMarkersCanExecute); }
/// <summary> /// Constructor /// </summary> /// <param name="query">Query to create the instance from</param> public FilterQueryViewModel(string query) { _filter = new CustomFilter(query); YalvRegistry.Instance.ActualWorkspace.CurrentAnalysis.AddFilter(_filter); _active = true; CommandCancelQuery = new CommandRelay(ExecuteCancelQuery, CanExecuteCancelQuery); }
/// <summary> /// Constructor, taking a LogEntryRepository containing the source of the logentries /// </summary> /// <param name="repository"></param> public RepositoryViewModel(LogEntryRepository repository) { Repository = repository; Active = true; CommandRemoveRepository = new CommandRelay(ExecuteRemoveRepository, CanExecuteRemoveRepository); CommandActiveRepository = new CommandRelay(ExecuteChangeActiveRepository, CanExecuteChangeActiveRepository); }
// BASE CONSTRUCTOR public BaseDataManagerTab() { // global var string forbiddenCategory = _MainSettings.ForbiddenCategoryName; // populating buffers and categories _selectedElements = new ObservableCollection <T>(); _categories = new ObservableCollection <string> { forbiddenCategory }; _selectedCategory = _categories[0]; _isChangeCommitted = false; // linking commands SaveAsNewRecordCommand = new CommandRelay(SaveAsNewRecord, ElementBufferEnteredDataValidationCheck); OverwriteRecordCommand = new CommandRelay(OverwriteRecord, CanExecute_RecordCommand_Overwrite); RemoveRecordCommand = new CommandRelay(RemoveSelectedRecord, CanExecute_RecordCommand_Remove); AddNewCategoryCommand = new CommandRelay(AddNewCategory, CanExecute_AddCategoryCommand); RemoveCategoryCommand = new CommandRelay(RemoveCategory, CanExecute_RemRenCategoryCommand); RenameCategoryCommand = new CommandRelay(RenameCategory, CanExecute_RemRenCategoryCommand); ExportCommand = new CommandRelay(Export, CanExecute_ExportCommand); ImportCommand = new CommandRelay(Import, CanExecute_ImportCommand); }
public LoginPageViewModel( ) { CreateUserCommand = new CommandRelay <Object>(CreateUser, CanCreateUser); _INPCInvoke = new INPCInvoker(this); _Mask = ""; _MaskChar = '*'; ValidateUserCommand = new CommandRelay <Object>(ValidateUser, CanValidateUser); }
public MainWindowViewModel( ) { _INPCInvoke = new INPCInvoker(this); InitializeUICommand = new CommandRelay <Object>(_InitialiseUI); SelectEngCommand = new CommandRelay <Object>(_InvokeENGLocalisation, _CanLocaliseToENG); SelectItaCommand = new CommandRelay <Object>(_InvokeITALocalisation, _CanLocaliseToITA); DisplayAboutCommand = new CommandRelay <Object>(_InvokeDisplayAbout, _CanDisplayAboutPage); DisplayConvertCommand = new CommandRelay <Object>(_InvokeDisplayConvert, _CanDisplayConvertPage); DisplaySettingsCommand = new CommandRelay <Object>(_InvokeDisplaySettings, _CanDisplaySettingsPage); }
public void SetUp() { pool = new ObjectPool(); eventBus = new EventBus(pool); commandRelay = new CommandRelay(eventBus, pool); server = new LoginServer(); userService = new UserService(); userWidget = new UserWidget(); }
public void SetUp() { var pool = new ObjectPool(); eventBus = new EventBus(pool); testObj = new CommandRelay(eventBus, pool); DummyCommand.ExecuteCount = 0; DummyCommand.LastValue = 0; AsyncCommand.triggeringEvents.Clear(); AsyncCommand.ClearAll(); }
// base constructor: public DataBaseViewModel(IRepositoryManagerOperations <T> dataProvider, string tabTitle) : base(tabTitle) { _dataProvider = dataProvider; _records = new ObservableCollection <T>(); GenerateAvailableIdCommand = new CommandRelay(GenerateAvailableId, CanExecute_GenerateAvailableIdCommand); SaveRecordCommand = new CommandRelay(SaveRecord, CanExecute_SaveRecordCommand); UpdateRecordCommand = new CommandRelay(UpdateRecord, CanExecute_UpdateCommand); DeleteRecordCommand = new CommandRelay(DeleteRecord, CanExecute_DeleteCommand); RefreshKeysCollection(); }
//Constructor: public CareTakerViewModel(IDataModelCommandOperations dataCommandProvider, IDataModelQueryOperations dataQueryProvider) : base("Menadżer Kluczy") { _dataCommandProvider = dataCommandProvider; _dataQueryProvider = dataQueryProvider; RegisteredEmployee = new PresentedRegisteredEmployee(); RegisterEmployeeCommand = new CommandRelay(RegisterEmployee, () => true); HandoverTheKeyCommand = new CommandRelay(HandoverTheKey, CanExecute_HandOverTheKey); TakeTheKeyBackCommand = new CommandRelay(TakeTheKeyBack, CanExecute_TakeTheKeyBack); ResetRegistrationCommand = new CommandRelay(ClearRegistration, CanExecute_ClearRegistration); }
public MainPageViewModel( ) { _INPCInvoke = new INPCInvoker(this); AddServerCommand = new CommandRelay <Object>(AddServer); CopyCommand = new CommandRelay <Object>(CopyContnet, CanCopyContnetContent); ExportCommand = new CommandRelay <Object>(ExportContnet, CanExportContent); GenerateCommand = new CommandRelay <Object>(GenerateScriptContnet, CanGenerateScriptContnet); ToggleServerInfoCommand = new CommandRelay <Object>(ToggleServerInfo); ValidateCommand = new CommandRelay <Object>(ValidateScript, CanValidateScript); ViewScriptCommand = new CommandRelay <Object>(ToggleDisplayingScript); }
public DocumentConverterViewModel() { _INPCInvoke = new INPCInvoker(this); _XPDFConverter = new FatturaElecttronicaConversionManager( ); SelectDestinationCommand = new CommandRelay <Object>(SelectDestination, ConversionInProgressPredicate); SelectSourceCommand = new CommandRelay <Object>(SelectSource, ConversionInProgressPredicate); XPDFConvertCommand = new CommandRelay <Object>(XPDFConvert, ConversionInteractionAllowed); ConversionInProgress = false; _XPDFConverter.FileConversionUpdateEvent += _CProgressUpdateEventHandler; _XPDFConverter.StateChangedEvent += _CStateChangedEventHandler; }
// Constructor: public ReportViewModel(IDataModelQueryOperations queryProvider) : base("Raport o stanie kluczy") { _queryProvider = queryProvider; Detail = new PresentedDetail(); ShowAllRoomKeysCommand = new CommandRelay(ShowAllRoomKeys, () => true); ShowHandoveredRoomKeysCommand = new CommandRelay(ShowHandoveredRoomKeys, () => true); ShowRemainingRoomKeysCommand = new CommandRelay(ShowRemainingRoomKeys, () => true); ShowSpecifiedKeyCommand = new CommandRelay(ShowSpecifiedKey, () => true); ResetKeysCollection(); }
// CONSTRUCTOR public Tab() { // -> Globals: _MainSettings = MainSettings.Instance; _Annalist = Annalist.Instance; // -> Tab Commands: ToggleRenamingCommand = new CommandRelay(m => ToggleRenamingRequested?.Invoke(this, EventArgs.Empty), CanExecute_ToggleRenamingCommand); CloseCommand = new CommandRelay(CloseTab, () => true); MoveTabLeftCommand = new CommandRelay(m => MoveTabLeftRequested?.Invoke(this, EventArgs.Empty), () => true); MoveTabRightCommand = new CommandRelay(m => MoveTabRightRequested?.Invoke(this, EventArgs.Empty), () => true); MoveTabToLeftEndCommand = new CommandRelay(m => MoveTabToLeftEndRequested?.Invoke(this, EventArgs.Empty), () => true); MoveTabToRightEndCommand = new CommandRelay(m => MoveTabToRightEndRequested?.Invoke(this, EventArgs.Empty), () => true); }
public AddFolderPathVM(IWinSimple win) { _callingWin = win; CommandExit = new CommandRelay(commandExitExecute, p => true); CommandSave = new CommandRelay(commandSaveExecute, commandSaveCanExecute); CommandAdd = new CommandRelay(commandAddExecute, commandAddCanExecute); CommandRemove = new CommandRelay(commandRemoveExecute, commandRemoveCanExecute); CommandSelectFolder = new CommandRelay(commandSelectFolderExecute, p => true); IList <PathItem> folders = GlobalHelper.ParseFolderFile(GlobalHelper.FOLDERS_FILE_PATH); _pathList = folders != null ? new ObservableCollection <PathItem>(folders) : new ObservableCollection <PathItem>(); ListChanged = false; }
private SettingsViewModel( ) { _INPCInvoker = new INPCInvoker(this); this.PropertyChanged += _SettingsViewModelPropertyChanged; SelectDefaultDestinationCommand = new CommandRelay <object>(_InvokeSelectDefaultDestinationDirectory); SelectDefaultSourceCommand = new CommandRelay <object>(_InvokeSelectDefaultSourceDirectory); PrinterList = new ObservableCollection <String>( ); foreach (String PrinterName in System.Drawing.Printing.PrinterSettings.InstalledPrinters) { PrinterList.Add(PrinterName); } Settings.Default.TempDestinationDirectory = null; Settings.Default.TempSourceDirectory = null; }
// CONSTRUCTOR public MainWindowViewModel() { // DATA MANAGERS _conductorManager = ConductorDataManager.Instance; _insulatorSetManager = InsulatorSetDataManager.Instance; // TABS CONTROL _tabs = new ObservableCollection <ITab>(); _tabs.CollectionChanged += Tabs_CollectionChanged; // COMMANDS // -> Main Menu: NewSectionCommand = new CommandRelay(NewSection, () => true); OpenProjectCommand = new CommandRelay(OpenProject, () => true); //SaveProjectCommand = new CommandRelay(SaveProject, () => false); SaveProjectAsCommand = new CommandRelay(SaveProjectAs, CanExecute_SaveAsCommand); OpenConductorDatabaseManagerCommand = new CommandRelay(OpenConductorDatabaseManager, () => true); OpenAttachmentSetDatabaseManagerCommand = new CommandRelay(OpenAttachmentSetDatabaseManager, () => true); OpenAboutTabCommand = new CommandRelay(OpenAboutTab, () => true); ExitCommand = new CommandRelay(Exit, () => true); }
/// <summary> /// Class constructor /// </summary> public DisplayLogViewModel(IManageTextMarkersViewModel interfaceTextMarkerViewModel) { CommandClearFilters = new CommandRelay(CommandClearFiltersExecute, CommandClearFilterCanExecute); CommandResetFilter = new CommandRelay(CommandResetFilterExecute, CommandResetFilterCanExecute); CommandApplyFilter = new CommandRelay(CommandApplyFilterExecute, CommandApplyFilterCanExecute); FilterYalvView = new CommandRelay(CommandFilterYalvView, CommandApplyFiltersCanExecute); SelectAll = true; IsFiltered = true; LogEntryRowViewModels = new ObservableCollection <LogEntryRowViewModel>(); RebuildLogView(LogEntryRowViewModels); _filterViewModel = new FilterConverterViewModel(YalvRegistry.Instance.ActualWorkspace.CurrentAnalysis); _filterViewModel.PropertyChanged += (sender, args) => RefreshView(); interfaceTextMarkerViewModel.MarkerDeleted += (sender, args) => OnMarkerDeleteExecuted(sender, (TextMarkerEventArgs)args); interfaceTextMarkerViewModel.MarkerAdded += (sender, args) => RefreshView(); // Default constructor contains column definitions // The callback is invocked when a column filter string item is changed // so we know that we should update the viewmodel filter mDataGridColumns = new ColumnsViewModel(ColumnsVmUpdateColumnFilter); }
public void OnCanExecuteChanged() { CommandRelay c = new CommandRelay(null, delegate { return(true); }); Boolean isHandlerCalled = false; EventHandler a = delegate(object sender, EventArgs args) { isHandlerCalled = true; }; try { c.CanExecuteChanged += a; c.CanExecute(null); Assert.IsTrue(isHandlerCalled); } finally { c.CanExecuteChanged -= a; } }
/// <summary> /// Standard constructor /// </summary> public YalvViewModel() { _manageRepoViewModel = new ManageRepositoryViewModel(); _manageRepoViewModel.ActiveChanged += ManageRepoViewModelOnPropertyChanged; _logAnalysis = new LogAnalysis(); YalvRegistry.Instance.ActualWorkspace.CurrentAnalysis = _logAnalysis; _manageTextMarkersViewModel = new ManageTextMarkersViewModel(_logAnalysis); _logEntryRows = new DisplayLogViewModel(_manageTextMarkersViewModel); CommandCancelProcessing = new CommandRelay(CommandCancelProcessingExecuted, CommandCancelProcessingCanExecute); CommandRefresh = new CommandRelay(CommandRefreshExecute, CommandRequiresDataCanExecute); CommandDelete = new CommandRelay(LogEntryRows.CommandDeleteExecute, LogEntryRows.CommandDeleteCanExecute); CommandUpdateTextMarkers = new CommandRelay(_manageTextMarkersViewModel.CommandUpdateTextMarkersExecute, _manageTextMarkersViewModel.CommandUpdateTextMarkersCanExecute); CommandUpdateDelta = new CommandRelay(CommandUpdateDeltaExecute, CommandUpdateDeltaCanExecute); }
// CONSTRUCTORS public CalculatorTab(string tabTitle) { ConductorBase = ConductorDataManager.Instance; _conductorAdvencedDisplayMode = false; _categoryOverview = new ObservableCollection <string>(ConductorBase.GetAvailableCategories()); _selectedCategory = _categoryOverview[0]; _conductorSearchMode = false; _searchedPhrase = ""; _conductorSearchResults = new ObservableCollection <Conductor>(); UserSection = new UserSection(); UserSection.SpatialModelUpdate += OnSpatialModelUpdate; PresentedResultantSection = new PresentedResultantSection(); Solver = new SolverViewModel(MainSettings.Instance.MainEPS, MainSettings.Instance.GravitionalAcceleration); Solver.SubscribeOn_SolverCalculationsReportSent_Event(OnSolverCalculationsReportSent); Solver.PropertyChanged += OnSolverPropertyChanged; TabTitle = tabTitle; LoadSectionModelFromCsvCommand = new CommandRelay(UserSection.LoadSectionModelFromCsv, () => true); SaveSectionModelAsCsvCommand = new CommandRelay(UserSection.SaveSectionModelAsCsv, () => true); JustAddSpan = new CommandRelay(UserSection.JustAddSpan, () => true); JustRemoveSpan = new CommandRelay(UserSection.JustRemoveSpan, CanExecute_JustRemoveSpanCommand); AddSpanBefore = new CommandRelay(UserSection.AddSpanBeforeSelectedSpan, CanExecute_BasicSectionCommand); AddSpanAfter = new CommandRelay(UserSection.AddSpanAfterSelectedSpan, CanExecute_BasicSectionCommand); ClearSpan = new CommandRelay(UserSection.ClearSelectedSpan, CanExecute_BasicSectionCommand); RemoveSpan = new CommandRelay(UserSection.RemoveSelectedSpan, CanExecute_RemoveSpanCommand); ClearAll = new CommandRelay(UserSection.ClearBackToBasicSection, CanExecute_ClearAllSectionCommand); ManuallyCheckUserSectionIntegrity = new CommandRelay(UserSection.ManualIntegrityCheck, () => true); ToggleXAxisDataInputModeCommand = new CommandRelay(ToggleXAxisDataInputMode, () => true); CloseReportCommand = new CommandRelay(UserSection.HideReport, UserSection.CanExecute_HideReport); ToggleConductorDetailsCommand = new CommandRelay(ToggleConductorDetails, () => true); }
/// <summary> /// Ctor from an existing log analysis /// </summary> /// <param name="filter"></param> public FilterQueryViewModel(CustomFilter filter) { _filter = filter; _active = false; CommandCancelQuery = new CommandRelay(ExecuteCancelQuery, CanExecuteCancelQuery); }
public AboutViewModel( ) { _INPCInvoker = new INPCInvoker(this); ConversionTotal = 0; OpenDonationLink = new CommandRelay <object>(_InvokeOpenDonationLink); }
public LoginPageViewModel( ) { _INPCInvoke = new INPCInvoker(this); ValidateUserCommand = new CommandRelay <Object>(ValidateUser, CanValidateUser); }