public BatchFileRunnerVM(LogScrollerVM logScroller, BatchFileShim batchFileShim) { DisplayName = "Batch File Runner"; RunAgainCmd = AsyncCommand.Create(tkn => RunAgain(tkn)); _batShim = ForwardLogs(batchFileShim); LogScroller = logScroller.ListenTo(this); }
public MainViewModel(ICurrencyServiceProvider provider) { _provider = provider; CanExecute = true; GetCurrencyWordValueCommand = AsyncCommand.Create( () => { return(Task.Run(() => { CanExecute = false; try { CurrencyWordValue = provider.GetCurrencyWordValue(Convert.ToDecimal(CurrencyNumericValue)); } catch (Exception ex) { AddErrors(ex, nameof(CurrencyNumericValue)); } finally { CanExecute = true; } })); }); }
public AppointmentViewModel( IMedicalSpecializationDataService medicalSpecializationDataService, IBuildingDataService buildingDataService, IProfileDataService profileDataService, ISuggestionProvider geoSuggestionProvider, IEventAggregator eventAggregator) { this.MedicalSpecializationDataService = medicalSpecializationDataService; this.GeoSuggestionProvider = geoSuggestionProvider; this.BuildingDataService = buildingDataService; this.ProfileDataService = profileDataService; this.EventAggregator = eventAggregator; this.PageContract = new PageControlContract(default(int), this.MedicalSpecializationDataService); this.PageSizes = new ObservableCollection <int> { 2, 10, 20, 50, 100, 200 }; this.LoadedCommand = AsyncCommand.Create(this.OnLoadedAsync); this.OpenSpecializationCommand = new RelayCommand( parameter => { var args = (List <int>)parameter; this.EventAggregator.GetEvent <OpenSpecializationDoctorsEvent>().Publish( new OpenSpecializationDoctorsArgs { PolyclinicId = args[1], SpecializationId = args[0], ParentViewModel = this }); }); }
public MainWindowViewModel() { // Initializing the lists. ApiList = new ObservableCollection <ApiNames>(Enum.GetValues(typeof(ApiNames)).Cast <ApiNames>().ToList()); SelectedApi = ApiNames.BlockchainInfo; WalletTypeList = new ObservableCollection <Transaction.WalletType>(Enum.GetValues(typeof(Transaction.WalletType)).Cast <Transaction.WalletType>().ToList()); SendAddressList = new BindingList <SendingAddress>(); UtxoList = new BindingList <UTXO>(); ReceiveList = new BindingList <ReceivingAddress>(); // Initializing Commands. GetUTXOCommand = AsyncCommand.Create(() => GetUTXO()); MakeTxCommand = new BindableCommand(MakeTx, CanMakeTx); CopyTxCommand = new RelayCommand(CopyTx, () => !string.IsNullOrEmpty(RawTx)); ShowQrWindowCommand = new RelayCommand(ShowQrWindow, () => !string.IsNullOrEmpty(RawTx)); ShowJsonWindowCommand = new RelayCommand(ShowJsonWindow, () => !string.IsNullOrEmpty(RawTx)); ShowEditWindowCommand = new RelayCommand(ShowEditWindow); // These moved below to avoid throwing null exception. ReceiveList.ListChanged += ReceiveList_ListChanged; SelectedUTXOs = new ObservableCollection <UTXO>(); SelectionChangedCommand = new BindableCommand(SelectionChanged); SelectedWalletType = Transaction.WalletType.Normal; }
public MedicalCardRecordViewModel( int recordId, object parentViewModel, IMedicalRecordDataService recordDataService, IAttachmentDataService attachmentDataService, IProfileDataService profileDataService, IEventAggregator eventAggregator) { this.RecordId = recordId; this.RecordDataService = recordDataService; this.AttachmentDataService = attachmentDataService; this.ProfileDataService = profileDataService; this.EventAggregator = eventAggregator; this.Attachments = new ObservableCollection <AttachmentInfoWrapper>(); this.LoadedCommand = AsyncCommand.Create(this.OnLoadedAsync); this.OpenAttachmentCommand = AsyncCommand.Create <int>(this.OnOpenAttachmentAsync); this.ShowAttachmentInFolderCommand = AsyncCommand.Create <int>(this.OnShowAttachmentAsync); this.BackCommand = new RelayCommand( () => this.EventAggregator.GetEvent <NavigationEvent>().Publish(parentViewModel)); this.OpenAssociatedRecordCommand = new RelayCommand(() => this.EventAggregator.GetEvent <OpenRecordEvent>().Publish(new OpenRecordEventArgs { RecordId = this.Record.AssociatedRecordId.Value, ParentViewModel = this })); this.OpenDoctorCommand = new RelayCommand(() => this.EventAggregator.GetEvent <OpenDoctorEvent>().Publish(new OpenDoctorEventArgs { DoctorId = this.Record.Author.Id, ParentViewModel = this })); }
public DoctorTimetableViewModel(int doctorId, object parentViewModel, IAppointmentDataService appointmentDataService, IProfileDataService profileDataService, INotificationService notificationService, IEventAggregator eventAggregator, IRequestCoordinator requestCoordinator) { this.DoctorId = doctorId; this.ParentViewModel = parentViewModel; this.AppointmentDataService = appointmentDataService; this.ProfileDataService = profileDataService; this.NotificationService = notificationService; this.EventAggregator = eventAggregator; this.Appointments = new TrulyObservableCollection <CalendarItemWrapper>(); this.UserId = requestCoordinator.UserId.Value; this.LoadedCommand = AsyncCommand.Create(this.OnLoadedAsync); this.SelectedDateChangedCommand = AsyncCommand.Create <DateTime>(this.OnSelectedDateChangedAsync); this.ScheduleAppointmentCommand = AsyncCommand.Create <DateTime>(this.OnScheduleAsync); this.CancelAppointmentCommand = AsyncCommand.Create <int>(this.OnCancelAsync); this.OpenDoctorCommand = new RelayCommand( () => this.EventAggregator.GetEvent <OpenDoctorEvent>().Publish( new OpenDoctorEventArgs { DoctorId = this.DoctorId, ParentViewModel = this })); this.BackCommand = AsyncCommand.Create(async() => { await this.NotificationService.UnsubscribeAsync(this.DoctorId, this.SelectedDate); this.EventAggregator.GetEvent <NavigationEvent>().Publish(parentViewModel); }); BindingOperations.EnableCollectionSynchronization(this.Appointments, lockObject); }
public InfoPopupViewModel(IAppUpdater appUpdater, bool includePreReleases) { _appUpdater = appUpdater; _includePreReleases = includePreReleases; OpenUrlCommand = new DelegateCommand <string>(OpenAboutUrl); CheckForUpdatesCommand = AsyncCommand.Create(CheckForUpdatesAsync); UpdateCommand = AsyncCommand.Create(UpdateAppAsync); }
public Toolbar() { InitializeComponent(); var navigationService = DependencyContainer.Instance.GetInstance <INavigationService>(); TapCommandEffect.SetTap(BackButton, AsyncCommand.Create(() => navigationService.NavigateBackAsync())); }
public ElementTabViewModel(T currentItem) { CurrentItem = currentItem; EditItem = CopyItem(currentItem); SaveItemCommand = AsyncCommand.Create(token => SaveItemAsync(token, EditItem)); DeleteItemCommand = AsyncCommand.Create(token => DeleteItemAsync(token, EditItem)); }
internal ScanPageViewModel(ILogger logger, IScannedFileStore scannedFileStore, string userAppDataPath) : base(scannedFileStore, userAppDataPath) { _logger = logger; Locations = new List <ScanLocation>(); Progress = 0; ScanComplete += ShowResultPage; Loaded = AsyncCommand.Create(OnLoaded); }
public RegisterViewModel(IAccountService accountService, IDialogCoordinator dialogCoordinator) { this.AccountService = accountService; this.DialogCoordinator = dialogCoordinator; this.CheckPasswordsCommand = AsyncCommand.Create <IEnumerable <PasswordBox> >(this.ValidateRegistrationInfoAsync); this.RegisterCommand = AsyncCommand.Create <IEnumerable <PasswordBox> >(this.RegisterAsync); }
public PageImagesViewModel(string link) { _page = 0; _imgPerPage = 20; Link = link; SelectedImage = null; Images = null; DoWorkCommand = AsyncCommand.Create(DoWork); }
public TestConnectionViewModel(IPluginRepository pluginRepository) { _pluginRepository = pluginRepository; StatusIndicator = new StatusIndicatorViewModel(); Notifications = new NotificationCenterViewModel { ShowEmptyMessage = false, ShowTimeStamp = false }; TestConnectionCommand = AsyncCommand.Create(TestConnection); }
public FundTabListViewModel(Fund fund) { Header = fund.Name; // _mainWindowViewModel = mainWindowViewModel; CurrentFund = fund; LoadFundCommand = AsyncCommand.Create(token => LoadCurrentFundAsync(token)); }
/// <summary> /// We usually init all commands in a "InitCommands" method which is called in constructor. /// </summary> private void InitCommands() { GoToSillyDudeCommand = AsyncCommand.Create(parameter => GoToSillyDudeAsync((SillyDudeVmo)parameter)); SortSillyPeopleCommand = AsyncCommand.Create(SortSillyPeopleAsync); OnScrollBeginCommand = new Command( () => System.Diagnostics.Debug.WriteLine("SillyInfinitePeopleVm: OnScrollBeginCommand")); OnScrollEndCommand = new Command( () => System.Diagnostics.Debug.WriteLine("SillyInfinitePeopleVm: OnScrollEndCommand")); }
public MainWindowViewModel() { Url = "http://www.example.com/"; Operations = new ObservableCollection <CountUrlBytesViewModel>(); CountUrlBytesCommand = new DelegateCommand(() => { var countBytes = AsyncCommand.Create(token => MyService.DownloadAndCountBytesAsync(Url, token)); countBytes.Execute(null); Operations.Add(new CountUrlBytesViewModel(this, Url, countBytes)); }); }
protected ListTabViewModel(ITabOwner mainWindowViewModel) { _mainWindowViewModel = mainWindowViewModel; LoadAllCommand = AsyncCommand.Create(token => LoadAllAsync(token)); AddItemCommand = new RelayCommand(obj => AddItem()); OpenItemCommand = new RelayCommand(obj => OpenItem(obj as T)); DeleteItemCommand = new RelayCommand(obj => DeleteItemAsync(obj as T)); }
public EventTreeViewModel(RelayCommand editCmd) { _dbs = new GXEventService(); InitEvents(); Messenger.Base.Register <UpdateTreeViewMsg>(this, OnUpdateTreeViewReceived); LoadEventsCommand = new RelayCommand( (object q) => LoadEvents(q), (object q) => CanLoadEvents(q) ); EditEventCommand = editCmd; DoWorkCommand = AsyncCommand.Create(DoWork); }
private void CommandInit() { LoadAllFund = AsyncCommand.Create(async(token) => { try { await LoadFundAsync(token); } catch (Exception ex) { MessageBox.Show(ex.Message); } }); }
private async Task <DeviceBatchScanVM> InitializeAsync(DeviceBatch batch) { return(await Task.Run(async() => { InstrumentService.LJVScanCoordinator.PurgeSubscribers(); InstrumentService.LJVScanCoordinator.SelectedCoordsDict = InstrumentService.LJVScanCoordinator.TheCoordsDictsDict["XinYan"]; theDeviceBatch = batch; //calculate presentTestCondition HashSet <string> testConditionsFromChildren = new HashSet <string>(); foreach (Device d in theDeviceBatch.Devices) { foreach (DeviceLJVScanSummary summary in d.DeviceLJVScanSummaries) { testConditionsFromChildren.Add(summary.TestCondition); } } int numberOfScans = testConditionsFromChildren.Count; int daysSinceFabrication = (DateTime.Now - theDeviceBatch.FabDate).Days; string presentTestCondition = string.Concat("t", numberOfScans + 1, ".", daysSinceFabrication); BatchScanSpec.TestCondition = presentTestCondition; Debug.WriteLine("presentTestCondition: " + presentTestCondition); //create sdsvms for each device foreach (Device d in theDeviceBatch.Devices) { var newSDSVM = await SingleDeviceScanVM.CreateAsync(d, ctx); newSDSVM.SaveDirectory = string.Concat(theDeviceBatch.FilePath, @"\", presentTestCondition); ScanVMs.Add(newSDSVM); } UpdateBatchScanSpec(); //CopyPreviousScanSpecs(); ScanVMs.OrderBy(x => x.TheDeviceVM.TheDevice.BatchIndex); ScanSelectedDevicesCommand = AsyncCommand.Create(token => ScanSelectedDevices(token)); string prCamModel = ConfigurationManager.AppSettings.Get("BatchTestSystem"); if (prCamModel == "BTS1") { delaysDict["Initialize"] = 50000; delaysDict["Swap"] = 42000; } else if (prCamModel == "BTS2") { delaysDict["Initialize"] = 17000; delaysDict["Swap"] = 23000; TheImagingControl = InstrumentService.LJVScanCoordinator.TheImagingControl; } else { Debug.WriteLine("BatchTestSystem needs to be properly set in App.Config"); } return this; }).ConfigureAwait(false)); }
public Playlist(ViewModelServiceContainer container, IValidator <Playlist> validator, IDialogViewModel dialogViewModel, IMediaItemMapper mediaItemMapper, PlaylistModel model) : base(model, validator, container?.Messenger) { if (container == null) { throw new ArgumentNullException(nameof(container), $"{nameof(container)} {Resources.IsRequired}"); } SkipChangeTracking = true; using (BusyStack.GetToken()) { _itemsLock = new object(); _mediaItemMapper = mediaItemMapper ?? throw new ArgumentNullException(nameof(mediaItemMapper), $"{nameof(mediaItemMapper)} {Resources.IsRequired}"); _dialogViewModel = dialogViewModel ?? throw new ArgumentNullException(nameof(dialogViewModel), $"{nameof(dialogViewModel)} {Resources.IsRequired}"); _sequenceProvider = container.SequenceService; _translator = container.LocalizationService; _title = model.Title; _description = model.Description; _repeatMode = (RepeatMode)model.RepeatMode; _isShuffeling = model.IsShuffeling; _sequence = model.Sequence; RepeatModes = new RangeObservableCollection <RepeatMode>(Enum.GetValues(typeof(RepeatMode)).Cast <RepeatMode>().ToList()); _history = new Stack <int>(); Items = new RangeObservableCollection <MediaItem>(); _items.CollectionChanged += (o, e) => OnPropertyChanged(nameof(Count)); BindingOperations.EnableCollectionSynchronization(Items, _itemsLock); View = CollectionViewSource.GetDefaultView(Items); // TODO add sorting by sequence OnPropertyChanged(nameof(Count)); LoadFromFileCommand = AsyncCommand.Create(LoadFromFile, () => CanLoadFromFile()); LoadFromFolderCommand = AsyncCommand.Create(LoadFromFolder, () => CanLoadFromFolder()); LoadFromUrlCommand = AsyncCommand.Create(LoadFromUrl, () => CanLoadFromUrl()); RemoveCommand = new RelayCommand <object>(Remove, CanRemove); RemoveRangeCommand = new RelayCommand <IList>(RemoveRange, CanRemoveRange); ClearCommand = new RelayCommand(() => Clear(), CanClear); AddRange(_mediaItemMapper.GetMany(model.MediaItems)); MessageTokens.Add(Messenger.Subscribe <PlayingMediaItemMessage>(OnPlaybackItemChanged, m => m.PlaylistId == Id && _items.Contains(m.Content))); Validate(); } SkipChangeTracking = false; }
public DashboardViewModel(IDashboardService dashboardService) { HelloText = new NotifyTaskCompletion <string>(dashboardService.GetText()); Url = "http://www.example.com/"; CountUrlBytesCommand = AsyncCommand.Create(token => MyService.DownloadAndCountBytesAsync(Url, token)); //Operations = new ObservableCollection<CountUrlBytesViewModel>(); //CountUrlBytesCommand = new AsyncDelegateCommand(() => //{ // var countBytes = AsyncCommand.Create(token => MyService.DownloadAndCountBytesAsync(Url, token)); // countBytes.Execute(null); // Operations.Add(new CountUrlBytesViewModel(this, Url, countBytes)); //}); }
/// <summary> /// Constructor /// </summary> public BusinessObjectFinder() { InitializeComponent(); ValidateBusinessObjectCode = true; LostFocusCommand = new RelayCommand(LostFocusValidateCatalogCode); OpenSearchViewCommand = new RelayCommand(OpenSearchView); OpenViewCommand = new RelayCommand(OpenView); OpenViewAsyncCommand = AsyncCommand.Create(OpenViewAsync); ChangeDisplayMemberPathCommand = new RelayCommand(ChangeDisplayMemberPath); SearchViewName = BaseConstants.BusinessObjectsSearchViewName; //ButtonImg.InitializationEndedEvent += SendInitializationEndedEvent; }
public SearchResultViewModel() { _results = new List <SearchResult>(); _fetchImageQueue = new Queue <int>(); _pageHistory = new List <int>(); _currentPage = -1; HasNext = true; HasPrev = false; Messenger.Base.Register <List <SearchResult> >(this, OnListResultsReceived); Messenger.Base.Register <NewQueryMsg>(this, OnNewQueryMsgReceived); Messenger.Base.Register <OldQueryMsg>(this, OnOldQueryMsgReceived); DoWorkCommand = AsyncCommand.Create(DoWork); PreviousPageCommand = AsyncCommand.Create(Rewind); }
public FilesTabVM2(IRepository <SyncableFileRemote> filesRepo, AppFileGrouper fileGrouper, IFileSynchronizer fileSynchronizer, ID7Client d7Client, BinUploaderCfgFile cfgFile) { _grouper = ForwardLogs(fileGrouper); _synchronizer = ForwardLogs(fileSynchronizer); _remotes = ForwardLogs(filesRepo); //_cfgFile = ForwardLogs(cfgFile); //_d7Client = ForwardLogs(d7Client); MainList = new VmList <RemoteVsLocalFile>(); UploadChangesCmd = AsyncCommand.Create(token => UploadChanges(token)); _remotes.SetClient(d7Client, cfgFile); _synchronizer.SetClient(d7Client); SetEventHandlers(); }
/// <summary> /// Internally exposed constructor for Unit Testing /// </summary> internal HomePageViewModel( IFolderBrowserDialogWrapper folderBrowserDialog, IScannedFileStore scannedFileStore, string userAppDataPath) : base(scannedFileStore, userAppDataPath) { _folderBrowserDialog = folderBrowserDialog; _userAppDataPath = userAppDataPath; this.Locations = new ObservableCollection <ScanLocation>(); _add = DelegateCommand.Create(AddLocation); _remove = DelegateCommand.Create(RemoveLocation, false); _scan = DelegateCommand.Create(ShowScanPage, false); this.Add = _add; this.Remove = _remove; this.Scan = _scan; this.PageLoaded = AsyncCommand.Create(OnPageLoaded); }
public DoctorViewModel( int doctorId, object parentViewModel, IDoctorDataService doctorDataService, IProfileDataService profileDataService, IEventAggregator eventAggregator) { this.DoctorId = doctorId; this.DoctorDataService = doctorDataService; this.ProfileDataService = profileDataService; this.EventAggregator = eventAggregator; this.LoadedCommand = AsyncCommand.Create(this.OnLoadedAsync); this.BackCommand = new RelayCommand( () => this.EventAggregator.GetEvent <NavigationEvent>().Publish(parentViewModel)); }
public UserSessionVM(IBasicAuthKeyFile authKeyFile) { DisplayName = NOT_LOGGED_IN; AuthFile = ForwardLogs(authKeyFile); LoginCmd = AsyncCommand.Create( tkn => _client.Login(AuthFile, tkn), x => !IsLoggedIn && _client != null); LogoutCmd = AsyncCommand.Create( tkn => _client.Logout(tkn), x => IsLoggedIn); RememberMeCmd = new RelayCommand( x => SaveOrDeleteSessionFile(), x => IsLoggedIn); }
private CachedVM() { Commands.Add(nameof(Clear), Command.Create(sender => { var that = (CachedVM)sender.Tag; RootControl.RootController.TrackAsyncAction(CachedGallery.ClearCachedGalleriesAsync(), (s, e) => { that.Refresh.Execute(); }); })); Commands.Add(nameof(Refresh), AsyncCommand.Create(async(sender) => { var that = (CachedVM)sender.Tag; that.Galleries = null; that.Galleries = await CachedGallery.LoadCachedGalleriesAsync(); })); }
private async Task <SingleDeviceScanVM> InitializeAsync(Device dev, DeviceBatchContext context) { return(await Task.Run(() => { TheDeviceVM = new DeviceVM(dev, ctx); RunVoltageSweepCommand = AsyncCommand.Create(token => ScanPixelAndProcessData(token)); TheLJVScanSummaryVM = new LJVScanSummaryVM(ctx); TheLJVScanSummaryVM.TheLJVScanSummary.Device = ctx.Devices.Where(x => x.DeviceId == TheDeviceVM.TheDevice.DeviceId).First(); TheLJVScanSummaryVM.TheLJVScanSummary.TestCondition = TheScanSpec.TestCondition; string bts = ConfigurationManager.AppSettings.Get("BatchTestSystem"); if (bts == "BTS2") { TheImagingControl = InstrumentService.LJVScanCoordinator.TheImagingControl; } return this; })); }