public DataViewModel() { Send = new AsynchronousCommand(() => { SendData(); }); }
public StockDetailsViewModel() { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } try { ImgImp = new ImageImporter(); if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } StockObj = ObjectMessenger.FindObject("SelectedStockItem"); StockObj.UpdateCurrentObject(); StockHistory = new ObservableCollection <skStockHistory>(StockObj.StockHistory.GetStockHistory(StockObj.Stockid)); ImageLIst = new ObservableCollection <string>(); _UpdateStock = new Command(BasicStockUpdate); _UploadPhotos = new Command(PhotoUpload); _OpenTransactionDetails = new Command(OpenTransactionObject); _Loaded = new AsynchronousCommand(Load); _SubmitPurchaseLinkCommand = new Command(SubmitPurchaseLinkMethod); ObjectSourceList = new ObservableCollection <Data.Interfaces.ITransaction>(skPurchase.GetPurchases()); _LinkPurchaseCommand = new Command(LinkPurchaseMethod); FillComboBoxes(); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
private void InitializeCommands() { //Command to start crawling startCrawlCommand = new AsynchronousCommand(async() => { if (File.Exists(@xmlRootPath)) { if (startCrawlCommand.CanExecute) { startCrawlCommand.CanExecute = false; } CrawlResult = await Task.Run(() => crawlerModel.GetCrawlResultAsync()); startCrawlCommand.CanExecute = true; } }); //Command for open file dialog openDialogCommand = new AsynchronousCommand(async() => { if (startCrawlCommand.CanExecute != false) { OpenFileDialog openFileDialog = new OpenFileDialog(); Nullable <bool> result = openFileDialog.ShowDialog(); if (result == true) { XmlRootPath = (openFileDialog.FileName); } } }); }
public ShellExtensionsViewModel() { // Create the RefreshExtensions Asynchronous Command. RefreshExtensionsCommand = new AsynchronousCommand(DoRefreshExtensionsCommand); RefreshExtensionsCommand.DoExecute(); }
public LoginViewModel() { _Enter = new AsynchronousCommand(Login); skStock s = new skStock(); _userobj = new skUser(); }
public MainViewModel() { _database = LabeledArticleDatabase.LoadFromFile(DataSetPath); Train = new AsynchronousCommand(TrainAction, () => !Train.IsExecuting); ResetTrainedStatus = new Command(ResetStatusAction); Test = new AsynchronousCommand(TestAction, () => !Test.IsExecuting && !string.IsNullOrWhiteSpace(TestingArticle)); EnhanceDatabase = new Command(EnhanceDatabaseAction, () => !string.IsNullOrWhiteSpace(TestingArticle)); TrainingStatus = "Not started yet"; }
/// <summary> /// Initializes a new instance of the <see cref="ServersViewModel"/> class. /// </summary> public ServersViewModel() { ServersView = (ListCollectionView)CollectionViewSource.GetDefaultView(Servers); ServersView.Filter += Filter; // Create the ReadServers Asynchronous Command. ReadServersCommand = new AsynchronousCommand(DoReadServersCommand); ReadServersCommand.DoExecute(); }
public ListViewModel() { _mangaManager = EdenKernel.Get<IMangaManager>(); _searchText = string.Empty; _dispatcher = Dispatcher.CurrentDispatcher; Mangas = new CollectionViewSource(); Mangas.Filter += Filter; LoadCommand = new AsynchronousCommand(Load); DeleteCommand = new AsynchronousCommand(Delete); }
public AddViewModel() { _edenApi = EdenKernel.Get<EdenApi>(); _mangaManager = EdenKernel.Get<IMangaManager>(); _dispatcher = Dispatcher.CurrentDispatcher; Mangas = new CollectionViewSource { Source = new List<JsonManga>() }; Mangas.Filter += Filter; FetchCommand = new AsynchronousCommand(Fetch); SaveCommand = new AsynchronousCommand(Save); }
private void InitCommands() { RefreshAssembliesCommand = new AsynchronousCommand(DoRefreshAssembliesCommand); CopyDisplayNameCommand = new Command(DoCopyDisplayNameCommand, false); ShowFilePropertiesCommand = new Command(DoShowFilePropertiesCommand, false); UninstallAssembliesCommand = new Command(DoUninstallAssembliesCommand, false); UninstallAssembliesCommand.Executing += UninstallAssembliesCommand_Executing; OpenAssemblyLocationCommand = new Command(DoOpenAssemblyLocationCommand, false); InstallAssemblyCommand = new Command(DoInstallAssemblyCommand); HelpCommand = new Command(DoHelpCommand); ShowAssemblyDetailsCommand = new Command(DoShowAssemblyDetailsCommand, false); }
public SettingsViewModel() { _accountHandler = EdenKernel.Get<IAccountHandler>(); _configurationManager = EdenKernel.Get<IConfigurationManager>(); _configuration = _configurationManager.LoadConfiguration(); if (_configuration.SaveUsername) { SaveUsername = _configuration.SaveUsername; Username = _configuration.Username; } LoginCommand = new AsynchronousCommand(Login); GetCommand = new AsynchronousCommand(Get); }
/// <summary> /// Initializes a new instance of the <see cref="HomeWindowViewModel"/> class. /// </summary> public HomeWindowViewModel(IUpdateMessagesListTask updateMessagesListTask, IMessageMediator mediator, IPleaseWaitService pleaseWaitService, IFolderWatcher folderWatcher, ITryFindParent tryFindParent, IOpenEmailFile openEmailFile) { this.updateMessagesListTask = updateMessagesListTask; this.mediator = mediator; this.pleaseWaitService = pleaseWaitService; this.folderWatcher = folderWatcher; this.tryFindParent = tryFindParent; this.openEmailFile = openEmailFile; RowDoubleClick = new Command <MouseButtonEventArgs>(OnRowDoubleClickExecute, OnRowDoubleClickCanExecute); CheckMessagesCommand = new AsynchronousCommand(OnCheckMessagesCommandExecute, () => !CheckMessagesCommand.IsExecuting); MarkAsReadCommand = new Command <MessageModel>(OnMarkAsReadCommandExecute); ImageSingleClick = new Command <MessageModel>(OnImageSingleClickExecute); Messages = new InitialLoadCommand().Load(); CheckMessagesWithWaiting(); }
/// <summary> /// Initializes a new instance of the <see cref="GACManagerViewModel"/> class. /// </summary> public GACManagerViewModel() { // Create the refresh assemblies command. RefreshAssembliesCommand = new AsynchronousCommand(DoRefreshAssembliesCommand, true); CopyDisplayNameCommand = new Command(DoCopyDisplayNameCommand, false); ShowFilePropertiesCommand = new Command(DoShowFilePropertiesCommand, false); UninstallAssemblyCommand = new Command(() => { }, false); OpenAssemblyLocationCommand = new Command(() => {}, false); InstallAssemblyCommand = new Command(() => {}); HelpCommand = new Command(() => {}); ShowAssemblyDetailsCommand = new Command(DoShowAssemblyDetailsCommand, false); // Update Gac Util Status info. GacUtilStatusInfo = GacUtil.CanFindExecutable() ? "GacUtil is installed" : "Cannot find GacUtil"; }
public CategoryManagerViewModel() { try { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } SearchFileter = new skCategory(); _GetRecordsCommand = new AsynchronousCommand(SearchMethod); LoadToolBar(); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public StockManagerViewModel() { try { if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { return; } SearchFilter = new skStock(); _GetRecordsCommand = new AsynchronousCommand(SearchMethod); _Export = new Command(ExportList); LoadToolBar(); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
public override void FromModel(AssemblyDescription model) { InternalAssemblyDescription = model; DisplayName = model.Name; Path = model.Path; Version = model.Version; Custom = model.Custom; ProcessorArchitecture = model.ProcessorArchitecture; Culture = model.Culture; if (model.PublicKeyToken != null) { PublicKeyToken = BitConverter.ToString(model.PublicKeyToken).Replace("-", string.Empty); } // Load the reserved fusion properties. //ReservedHash = BitConverter.ToString(model.FusionProperties.ReservedHashValue).Replace("-", string.Empty); //ReservedHashAlgorithm = model.FusionProperties.ReservedHashAlgorithmId; LoadExtendedPropertiesCommand = new AsynchronousCommand(DoLoadExtendedPropertiesCommand); }
public PersonManagerViewModel() { LoadSelectedPerson = new Command(LoadSelectedPersonMethod); LoadNewPerson = new Command(LoadNewPersonMethod); try { _GetRecordsCommand = new AsynchronousCommand(SearchMethod); actionbar = new ActionBar(); actionbar.Add(new ToolBarButton { Content = "Person Details", Command = LoadSelectedPerson }); actionbar.Add(new ToolBarButton { Content = "New Person", Command = LoadNewPerson }); } catch (Exception e) { ExepionLogger.Logger.LogException(e); ExepionLogger.Logger.Show(e); } }
public TransactionManagerViewModel() { try { if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject())) { return; } Transaction = new skTransaction(); _NewPurchase = new Command(OpenNewPurchase); _UpdateList = new AsynchronousCommand(SearchMethod); _TranDetails = new Command(OpenTranDetails); _Export = new Command(ExportList); actionbar = new ActionBar(); _Loaded = new AsynchronousCommand(SearchMethod); actionbar.Add(new ToolBarButton { Content = "Add New Purchase", Command = _NewPurchase }); actionbar.Add(new ToolBarButton { Content = "Transaction Details", Command = _TranDetails }); actionbar.Add(new ToolBarButton { Content = "Refresh List", Command = _UpdateList }); actionbar.Add(new ToolBarButton { Content = "Export Current", Command = _Export }); // SourceList = new List<dynamic>(Transaction.GetTransactionList()); // QuickSearch = new QuickSearch(SourceList); } catch (Exception E) { ExepionLogger.Logger.LogException(E); ExepionLogger.Logger.Show(E); } }
/// <summary> /// Initializes a new instance of the <see cref="CommandingSampleViewModel"/> class. /// </summary> public CommandingSampleViewModel() { Title = "Commanding Sample"; // Create the simple command - calls DoSimpleCommand. SimpleCommand = new Command(DoSimpleCommand); // Create the lambda command, no extra function necessary. LambdaCommand = new Command( () => { Messages.Add("Calling the Lamba Command - no explicit function necessary."); }); // Create the parameterized command. ParameterisedCommand = new Command(DoParameterisedCommand, true); // Create the enable/disable command, initially disabled. EnableDisableCommand = new Command( () => { Messages.Add("Enable/Disable command called."); }, false); // Create the events command. EventsCommand = new Command( () => { Messages.Add("Calling the Events Command."); }); // Create the async command. AsyncCommand1 = new AsynchronousCommand( () => { for (int i = 1; i <= 10; i++) { // Report progress. AsyncCommand1.ReportProgress(() => { Messages.Add(i.ToString()); }); System.Threading.Thread.Sleep(200); } }); // Create the async command. AsyncCommand2 = new AsynchronousCommand( () => { for (char c = 'A'; c <= 'Z'; c++) { // Report progress. AsyncCommand2.ReportProgress(() => { Messages.Add(c.ToString()); }); System.Threading.Thread.Sleep(100); } }); // Create the cancellable async command. CancellableAsyncCommand = new AsynchronousCommand( () => { for (int i = 1; i <= 100; i++) { // Do we need to cancel? if (CancellableAsyncCommand.CancelIfRequested()) { return; } // Report progress. CancellableAsyncCommand.ReportProgress(() => { Messages.Add(i.ToString()); }); System.Threading.Thread.Sleep(100); } }); // Create the disable during execution command. DisabledDuringExecutionAsyncCommand = new AsynchronousCommand( () => { for (int i = 1; i <= 10; i++) { // Report progress. DisabledDuringExecutionAsyncCommand.ReportProgress(() => { Messages.Add(i.ToString()); }); System.Threading.Thread.Sleep(200); } }); DisabledDuringExecutionAsyncCommand.DisableDuringExecution = true; // Create the event binding command. EventBindingCommand = new Command(DoEventBindingCommand); // Create the typed commands. IntTypedCommand = new Command <int>(DoIntTypedCommand); StringTypedCommand = new Command <string>(DoStringTypedCommand); }