public SearchResultsPageViewModel(ApplicationSettings settings, INavigationService navigationService, IImageSearchService imageSearchService, IHub hub, IAccelerometer accelerometer, IStatusService statusService, IShareDataRequestedPump shareMessagePump)
        {
            _settings = settings;
            _navigationService = navigationService;
            _imageSearchService = imageSearchService;
            _hub = hub;
            _accelerometer = accelerometer;
            _statusService = statusService;

            HomeCommand = _navigationService.GoBackCommand;
            ViewDetailsCommand = new DelegateCommand(ViewDetails, () => SelectedImage != null);
            LoadMoreCommand = new AsyncDelegateCommand(LoadMore);
            ThumbnailViewCommand = new DelegateCommand(ThumbnailView);
            ListViewCommand = new DelegateCommand(ListView);
            SplitViewCommand = new DelegateCommand(SplitView);
            SettingsCommand = new DelegateCommand(Settings);

            AddImages(_settings.SelectedInstance.Images);
            shareMessagePump.DataToShare = _settings.SelectedInstance.QueryLink;
            _statusService.Title = _settings.SelectedInstance.Query;
            _accelerometer.Shaken += accelerometer_Shaken;
            _navigationService.Navigating += NavigatingFrom;

            UpdateCurrentView(CurrentView);
            _hub.Send(new UpdateTileImageCollectionMessage(_settings.SelectedInstance));
        }
 public PreferencesViewModel(ApplicationSettings settings)
 {
     _settings = settings;
     ImageResultSize = _settings.ImageResultSize;
     Rating = _settings.Rating;
     ResetHistoryCommand = new AsyncDelegateCommand(ResetHistory);
 }
        public FileOpenPickerPageViewModel(ApplicationSettings settings, IImageSearchService imageSearchService, IFileOpenPickerUiManager fileOpenPicker)
        {
            _settings = settings;
            _imageSearchService = imageSearchService;
            _fileOpenPicker = fileOpenPicker;

            SearchCommand = new AsyncDelegateCommand(Search);
        }
        /// <summary>
        /// Fetch access token and refresh token. Load the list of files and folders
        /// </summary>
        /// <param name="authCode"></param>
        /// <returns></returns>
        public async Task Init(string authCode)
        {
            await Client.Auth.AuthenticateAsync(authCode);
            
            var cmd = new AsyncDelegateCommand(async _ => { await GetFolderItemsAsync("0"); });
            ExecuteCommand(cmd);

            IsLoggedIn = true;
        }
 public MainViewModel(IEnumerable <IFeature> features)
 {
     this.features            = new FeatureCollection(features);
     this.featuresView        = CollectionViewSource.GetDefaultView(this.features);
     this.featuresView.Filter = x => ((IFeature)x).IsVisible;
     this.featuresView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(IFeature.Group) + "." + nameof(IFeatureGroup.Name)));
     this.featuresView.SortDescriptions.Add(new SortDescription(nameof(IFeature.Group) + "." + nameof(IFeatureGroup.Order), ListSortDirection.Ascending));
     this.featuresView.SortDescriptions.Add(new SortDescription(nameof(IFeature.Order), ListSortDirection.Ascending));
     this.addOrRemoveFeaturesCommand = new AsyncDelegateCommand(this.AddOrRemoveFeatures);
 }
 public SettingsPageViewModel()
 {
     OpenFeedbackCommand   = new AsyncDelegateCommand(OnOpenFeedback);
     ChangePasswordCommand = new AsyncDelegateCommand(OnChangePassword);
     OpenAboutCommand      = new AsyncDelegateCommand(OnAbout);
     ChangeGroupingCommand = new Command(() => AccountDropDown = !_accountDropDown);
     IsAdmin                   = Settings.MyInfo.CurrentUser.IsAdmin.GetValueOrDefault();
     GroupByAccount            = Settings.GroupByAccount;
     ShowSelectAccountDropdown = Settings.ShowSelectAccountDropdown;
 }
Ejemplo n.º 7
0
            public TransactionsViewModel()
            {
                var items = Enumerable.Range(1, 500).Select(i => new Item {
                    Name = i.ToString()
                });

                Items = new ObservableCollection <Item>(items);

                RepeatCommand = new AsyncDelegateCommand <object>(Repeat, x => true);
            }
 public UserDetailPageViewModel(AppUserView selectedUser)
 {
     User = selectedUser;
     ToggleHeaderFrameCommand  = new Command <bool>((show) => ShowHeaderFrame = show);
     ToggleActionsFrameCommand = new Command <bool>((show) => ShowActionsFrame = show);
     EditUserCommand           = new AsyncDelegateCommand(OnEdit);
     DeleteUserCommand         = new AsyncDelegateCommand(OnDelete);
     ResetPasswordCommand      = new AsyncDelegateCommand(OnResetPassword);
     ShowHeaderFrame           = true;//Requested by Bassam to show user details as default
 }
Ejemplo n.º 9
0
 public FeedListView()
 {
     InitializeComponent();
     addFeedGrid.MaxWidth      = Window.Current.CoreWindow.Bounds.Width - 24; // Minus the margin defined by the Flyout
     viewModel                 = new Lazy <FeedListViewModel>(() => (FeedListViewModel)DataContext);
     pasteCommand              = new AsyncDelegateCommand(PasteUriAsync, CanPasteUri);
     Clipboard.ContentChanged += ClipboardContentChanged;
     selectionStateManager     = SelectionStateHelper.CreateManager(feedListView, selectItemsButton, cancelSelectionButton);
     selectionStateManager.PropertyChanged += SelectionStateManagerPropertyChanged;
 }
Ejemplo n.º 10
0
        public void AsyncDelegateCommand_RaiseCanExecuteChanged_Should_Invoke_Listeners()
        {
            bool invoked = false;
            var  c       = new AsyncDelegateCommand(_ => Task.CompletedTask);

            c.CanExecuteChanged += (s, e) => invoked = true;

            c.RaiseCanExecuteChanged();
            invoked.Should().BeTrue();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Constructor. Instanciates all commands
        /// </summary>
        /// <param name="modelNews">Model for news. Resolved by NInject</param>
        /// <param name="modelConferences">Model for conferences. Resolved by NInject</param>
        /// <param name="modelShows">Model for shows. Resolved by NInject</param>
        public SearchViewModel(ISearchable<News> modelNews, ISearchable<Conference> modelConferences, ISearchable<Show> modelShows)
        {
            _modelNews = modelNews;
            _modelConferences = modelConferences;
            _modelShows = modelShows;

            SearchCommand = new AsyncDelegateCommand<string>(SearchAsync);
            PinCommand = new RelayCommand<PinnableObject>(Pin);
            GoToDetailsPageCommand = new RelayCommand<VisualGenericItem>(GoToDetailsPage);
        }
Ejemplo n.º 12
0
        public TaskViewModel(IOpenFileService openFileService,
                             IModelProvider modelProvider,
                             IMessageService messageService)
        {
            this.messageService  = messageService;
            this.modelProvider   = modelProvider;
            this.openFileService = openFileService;

            clearCommand = new DelegateCommand(Clear, () => CanClear);
            loadCommand  = new AsyncDelegateCommand(LoadAsync);
        }
Ejemplo n.º 13
0
        public void ShowProgress()
        {
            if (ProgressActionViewModel != null)
              {
            ProgressText = ProgressActionViewModel.Text;
            AsyncDelegateCommand asyncDelegateCommand = new AsyncDelegateCommand(ProgressActionViewModel.Action,
                                                                             () => true, OnComplete, OnError);
            asyncDelegateCommand.Execute(null);

              }
        }
Ejemplo n.º 14
0
        public async Task AsyncDelegateCommand_Execute_AsExpected()
        {
            bool invoked = false;
            var  c       = new AsyncDelegateCommand(_ =>
                                                    { invoked = true; return(Task.CompletedTask); });

            c.Execute(null);
            await c.ExecutionTask;

            invoked.Should().BeTrue();
        }
Ejemplo n.º 15
0
 public SettlementViewReceiptPageViewModel(InvoicePaymentView invoicePaymentView)
 {
     Invoice     = invoicePaymentView;
     BackCommand = new AsyncDelegateCommand(Back);
     EmailList   = new ObservableCollection <string>
     {
         Settings.Email
     };
     AddEmailCommand  = new AsyncDelegateCommand(OnAddEmail);
     SendEmailCommand = new AsyncDelegateCommand(OnSendEmail);
 }
Ejemplo n.º 16
0
 public CustomerReturnGoodsViewModel()
 {
     CommandCustomerReturnGoodsSave = new DelegateCommand(CustomerReturnGoodsSave);
     CommandReturnGoodsSearch       = new AsyncQueryCommand(ReturnGoodsSearch, () => SaleRmaList, "订单");
     CommandGetDown        = new AsyncDelegateCommand(GetOrderDetailByOrderNo);
     CommandSetOrderRemark = new DelegateCommand(SetOrderRemark);
     ReturnGoodsGet        = new ReturnGoodsGet();
     ClearOrInitData();
     InitCombo();
     RmaPost = new RMAPost();
 }
Ejemplo n.º 17
0
 public CustomerStockoutRemindNotReplenishViewModel()
 {
     CommandGetOrder              = new AsyncDelegateCommand(GetOrder);
     CommandGetSaleByOrderId      = new AsyncDelegateCommand(GetSaleByOrderId);
     CommandGetSaleDetailBySaleId = new AsyncDelegateCommand(GetSaleDetailBySaleId);
     CommandCannotReplenish       = new DelegateCommand(CannotReplenish);
     CommandGetRmaSaleDetailByRma = new AsyncDelegateCommand(GetRmaSaleDetailByRma);
     CommandSetRmaRemark          = new DelegateCommand(SetRmaRemark);
     InitCombo();
     OutOfStockNotifyRequest = new OutOfStockNotifyRequest();
 }
 public SettlementsPageViewModel()
 {
     SearchCommand             = new AsyncDelegateCommand <SettlementsFilterModel>(OnSearch);
     ViewPendingReceiptCommand = new AsyncDelegateCommand <InvoicePaymentView>(OnViewPendingReceipt);
     ViewSettledReceiptCommand = new AsyncDelegateCommand <InvoicePaymentView>(OnViewSettledReceipt);
     TogglePendingCommand      = new Command <bool>((show) => ShowPending = show);
     ToggleSettledCommand      = new Command <bool>((show) => ShowSettled = show);
     ToggleCompletedCommand    = new Command <bool>((show) => ShowCompleted = show);
     FilterChangeCommand       = new AsyncDelegateCommand <SortColumnItem>(OnFilterChanged);
     ShowFilter = false;
 }
 public ReturnGoodsPaymentVerifyViewModel()
 {
     ReturnGoodsPayDto              = new ReturnGoodsPayDto();
     CommandSearch                  = new AsyncQueryCommand(SearchSaleRma, () => SaleRmaList, "收货单");
     CommandGetRmaSaleDetailByRma   = new AsyncDelegateCommand(GetRmaSaleDetailByRma);
     CommandCustomerReturnGoodsSave = new AsyncDelegateCommand(CustomerReturnGoodsSave);
     CommandGetRmaByOrder           = new AsyncDelegateCommand(GetRmaByOrder);
     CommandGetRmaDetailByRma       = new AsyncDelegateCommand(GetRmaDetailByRma);
     CommandSetRmaRemark            = new DelegateCommand(SetRmaRemark);
     InitCombo();
 }
 public OrderRequestDateChangePageViewModel(SalesOrder order)
 {
     CancelCommand = new AsyncDelegateCommand(OnCancel);
     SubmitCommand = new AsyncDelegateCommand(OnSubmit);
     Order         = order;
     if (order.DeliveryDate.HasValue)
     {
         CurrentDate = order.DeliveryDate.Value.DateTime;
     }
     Title = $"{nameof(AppResources.RequestDateChangeFor).Translate()} {order.Key}";
 }
Ejemplo n.º 21
0
 public SettingsController(ILauncherService launcherService, IAppInfoService appInfoService, IAppDataService appDataService, Lazy <SettingsLayoutViewModel> settingsLayoutViewModel,
                           Lazy <GeneralSettingsViewModel> generalSettingsViewModel, Lazy <InfoSettingsViewModel> infoSettingsViewModel)
 {
     this.launcherService           = launcherService;
     this.appInfoService            = appInfoService;
     this.appDataService            = appDataService;
     this.settingsLayoutViewModel   = new Lazy <SettingsLayoutViewModel>(() => InitializeSettingsLayoutViewModel(settingsLayoutViewModel));
     this.generalSettingsViewModel  = new Lazy <GeneralSettingsViewModel>(() => InitializeGeneralSettingsViewModel(generalSettingsViewModel));
     this.infoSettingsViewModel     = new Lazy <InfoSettingsViewModel>(() => InitializeInfoSettingsViewModel(infoSettingsViewModel));
     this.launchWindowsStoreCommand = new AsyncDelegateCommand(LaunchWindowsStore);
 }
Ejemplo n.º 22
0
 public AssociateViewModel(ICommonInfo dimensionService)
 {
     QueryCriteria           = new AssociateQueryCriteria();
     Stores                  = dimensionService.GetStoreList();
     PermissionLevels        = EnumerationUtility.ToList <AssociatePermission>();
     QueryCommand            = new AsyncDelegateCommand(OnQuery);
     RenotifyCommand         = new AsyncDelegateCommand(OnNotify, CanCommandExecute);
     DemoteCommand           = new AsyncDelegateCommand(OnDemote, CanCommandExecute);
     SelectAllCommand        = new DelegateCommand <bool?>(OnSelectAll);
     ReloadDepartmentCommand = new AsyncDelegateCommand(OnDepartmentReload);
 }
        public void Execute_Execute_WrongParameterType_InvalidOperationException()
        {
            var funcMock      = new Mock <Func <int, Task> >();
            var asyncDelegate = new AsyncDelegateCommand <int>(funcMock.Object,
                                                               exceptionHandler: exception =>
            {
                Assert.IsInstanceOfType(exception, typeof(InvalidOperationException));
                return(true);
            });

            asyncDelegate.Execute("test");
        }
Ejemplo n.º 24
0
        public InvoicesPageViewModel()
        {
            PayInvoicesCommand       = new AsyncDelegateCommand(OnPayInvoices);
            PayPartialCommand        = new AsyncDelegateCommand(OnPayPartial);
            AddMoneyOnAccountCommand = new AsyncDelegateCommand(OnAddMoneyOnAccount);
            LienWaiverCommand        = new AsyncDelegateCommand(OnLienWaiver);
            OpenInvoiceCommand       = new AsyncDelegateCommand(OnOpenInvoice);

            SearchCommand            = new AsyncDelegateCommand <InvoicesFilterModel>(OnSearch);
            FilterChangeCommand      = new AsyncDelegateCommand <SortColumnItem>(OnFilterChanged);
            IsSelectedChangedCommand = new Command <InvoiceModel>(invoiceModel => invoiceModel.IsSelected = !invoiceModel.IsSelected);
        }
 public IndividualPatientCardViewModel(DbContextFactory dbContextFactory, IViewProvider viewProvider, MainWindowViewModel mainWindowViewModel)
 {
     _dbContextFactory             = dbContextFactory;
     _viewProvider                 = viewProvider;
     _mainWindowViewModel          = mainWindowViewModel;
     ClassifyPatientTunningCommand = new AsyncDelegateCommand(ClassifyPatientTunningCommandHandler);
     PatientsCommand               = new AsyncDelegateCommand(o => _viewProvider.NavigateToPage <PatientsViewModel>(m =>
     {
         _mainWindowViewModel.Patient = null;
     }
                                                                                                                    ));
 }
 public CreditCardDetailPageViewModel(CustomerCreditCardTokenViewModel card)
 {
     CountryList = new ObservableCollection <KeyValuePair <string, string> >
     {
         new KeyValuePair <string, string>("us", "United States"),
         new KeyValuePair <string, string>("ca", "Canada"),
     };
     SelectedCountry = _countryList[0];
     Card            = card;
     CloseCommand    = new AsyncDelegateCommand(OnClose);
     SaveCommand     = new AsyncDelegateCommand(OnSave);
 }
Ejemplo n.º 27
0
        public async Task CanExecute_returns_false_during_execution_and_true_after_completion()
        {
            var tcs     = new TaskCompletionSource <bool>();
            var command = new AsyncDelegateCommand <int>(x => tcs.Task);

            command.Execute(42);
            command.CanExecute(42).Should().BeFalse();
            tcs.SetResult(true);
            await command.WaitForCompletionAsync();

            command.CanExecute(42).Should().BeTrue();
        }
Ejemplo n.º 28
0
        public void AsyncDelegateCommand_CanExecute_Should_Invoke_Lambad()
        {
            bool invoked = false;
            var  c       = new AsyncDelegateCommand(_ => Task.CompletedTask, _ =>
            {
                invoked = true;
                return(true);
            });

            c.CanExecute(null).Should().BeTrue();
            invoked.Should().BeTrue();
        }
Ejemplo n.º 29
0
        public BoardHomeViewModel(
            BoardViewModel boardVM,
            IArticleListViewModelFactory articleListViewModelFactory,
            IArticleCreationViewModelFactory articleCreationViewModelFactory
            )
        {
            BoardViewModel     = boardVM;
            BoardArticleListVM = articleListViewModelFactory.Create(LoadEntityListEnum.LoadByIds);
            ArticleCreationVm  = articleCreationViewModelFactory.Create(boardVM.Board);

            LoadBoardCommand = new AsyncDelegateCommand(LoadBoard);
        }
Ejemplo n.º 30
0
    public PrintsViewModel()
    {
        _showArchivedElements    = true;
        _showNonArchivedElements = true;

        if (!IsInDesignMode)
        {
            ServiceContext.GetService(out _translationManager);
            ServiceContext.GetService(out _printsService);
            ServiceContext.GetService(out _curaService);
            ServiceContext.GetService(out _settingsService);
            ServiceContext.GetService(out _downloadService);
            ServiceContext.GetService(out _cachingService);
        }

        PrintElementsViewSource         = new CollectionViewSource();
        PrintElementsViewSource.Filter += PrintElementsViewSource_OnFilter;
        PrintElementsViewSource.SortDescriptions.Add(new SortDescription(nameof(PrintElement.IsArchived), ListSortDirection.Ascending));
        PrintElementsViewSource.SortDescriptions.Add(new SortDescription(nameof(PrintElement.Name), ListSortDirection.Ascending));
        AvailableTags           = new ObservableCollection <string>();
        AvailableTagsViewSource = new CollectionViewSource {
            Source = AvailableTags
        };
        AvailableTagsViewSource.SortDescriptions.Add(new SortDescription(null, ListSortDirection.Ascending));
        VisibleTags = new ObservableCollection <string>();
        VisibleTags.CollectionChanged += (s, e) => PrintElementsViewSource.View.Refresh();

        var printElements = new FullyObservableCollection <PrintElement>();

        printElements.CollectionItemPropertyChanged += PrintElements_CollectionItemPropertyChanged;
        PrintElements = printElements;

        NewProjectFromModelsCommand    = new AsyncDelegateCommand(ExecuteNewProjectFromModels);
        NewProjectFromWebCommand       = new AsyncDelegateCommand(ExecuteNewProjectFromWeb);
        NewProjectFromArchiveCommand   = new AsyncDelegateCommand(ExecuteNewProjectFromArchive);
        NewProjectFromClipboardCommand = new AsyncDelegateCommand(ExecuteNewProjectFromClipboard);
        ReloadModelsCommand            = new AsyncDelegateCommand(ExecuteReloadModels);
        RefreshFilterCommand           = new DelegateCommand(ExecuteRefreshFilter);

        AddFilesToProjectCommand  = new AsyncDelegateCommand <PrintElement>(x => x != null, ExecuteAddFilesToProject);
        NewCuraProjectCommand     = new AsyncDelegateCommand <PrintElement>(x => x != null, ExecuteNewCuraProject);
        OpenProjectFolderCommand  = new DelegateCommand <PrintElement>(x => x != null, ExecuteOpenProjectFolder);
        OpenProjectWebsiteCommand = new DelegateCommand <PrintElement>(x => x != null && !string.IsNullOrEmpty(x.Metadata.Website), ExecuteOpenProjectWebsite);
        DeleteProjectCommand      = new AsyncDelegateCommand <PrintElement>(x => x != null, ExecuteDeleteProject);
        RenameProjectCommand      = new DelegateCommand <PrintElement>(x => x != null, ExecuteRenameProject);
        CreateTagCommand          = new DelegateCommand <PrintElement>(x => x != null, ExecuteCreateTag);

        OpenProjectFileCommand   = new DelegateCommand <PrintElementFile>(x => x != null, ExecuteOpenProjectFile);
        DeleteProjectFileCommand = new DelegateCommand <PrintElementFile>(x => x != null, ExecuteDeleteProjectFile);
        RenameProjectFileCommand = new DelegateCommand <PrintElementFile>(x => x != null, ExecuteRenameProjectFile);
        CopyProjectFileToCommand = new AsyncDelegateCommand <Tuple <PrintElementFile, string> >(x => x?.Item1 != null && !string.IsNullOrEmpty(x?.Item2), ExecuteCopyProjectFileTo);
    }
Ejemplo n.º 31
0
        public SearchHistoryPageViewModel(ApplicationSettings settings, INavigationService navigationService, IHub messageHub, IStatusService statusService)
        {
            _settings          = settings;
            _navigationService = navigationService;
            _messageHub        = messageHub;
            _statusService     = statusService;

            _statusService.Title       = "Searches";
            _settings.SelectedInstance = null;
            SearchCommand      = new DelegateCommand(Search);
            SettingsCommand    = new DelegateCommand(Settings);
            SearchQueryCommand = new AsyncDelegateCommand <string>(SearchQuery);
        }
 public CustomReturnGoodsUserControlViewModel()
 {
     CommandGetRmaSaleDetailByRma     = new AsyncDelegateCommand(GetRmaSaleDetailByRma);
     CommandSetRmaRemark              = new DelegateCommand(SetRmaRemark);
     CompletePaymentAcceptanceCommand = new AsyncDelegateCommand(OnCompletePaymentAcceptance, CanActionExecute);
     AcceptPaymentCommand             = new AsyncDelegateCommand(OnPaymentAccept, CanActionExecute);
     PreviewReturnGoodsReceiptCommand = new DelegateCommand(() => PrintCommon());
     PrintReturnGoodsReceiptCommand   = new DelegateCommand(() => PrintCommon(true));
     CompletePrintCommand             = new AsyncDelegateCommand(OnPrintComplete, CanActionExecute);
     ReturnGoodInStockCommand         = new AsyncDelegateCommand(OnReturnGoodsInStock, CanActionExecute);
     ConsignReturnGoodsCommand        = new AsyncDelegateCommand(OnReturnGoodsConsigned, CanActionExecute);
     ApplyPaymentNumberCommand        = new AsyncDelegateCommand(OnPaymentNumberApply, CanPaymentNumberApply);
 }
Ejemplo n.º 33
0
        public GiveFeedbackPageViewModel()
        {
            CloseCommand  = new AsyncDelegateCommand(OnClose);
            SubmitCommand = new AsyncDelegateCommand(OnSubmit);

            FeebackTypesList = new ObservableCollection <FeedbackTypeEnum>
            {
                FeedbackTypeEnum.None,
                FeedbackTypeEnum.Issue,
                FeedbackTypeEnum.Suggestion,
            };
            SelectedType = _feebackTypesList.First();
        }
Ejemplo n.º 34
0
 public MusicActions()
 {
     AppBar   = new AppBarController();
     Selected = new ObservableCollection <MusicItem>();
     Selected.CollectionChanged += (s, e) => SelectionChanged();
     //DeleteSelected = new UnitCommand(() => DeleteAll(Selected));
     PlaySelected       = new AsyncUnitCommand(() => PlayAll(SelectedList));
     AddSelected        = new AsyncUnitCommand(() => AddToPlaylistRecursively(SelectedList));
     DownloadSelected   = new AsyncUnitCommand(() => PimpStoreDownloader.Instance.SubmitAll(SelectedList));
     HandleMusicItemTap = new AsyncDelegateCommand <MusicItem>(item => {
         return(OnSingleMusicItemSelected(item));
     });
 }
        public SearchHistoryPageViewModel(ApplicationSettings settings, INavigationService navigationService, IHub messageHub, IStatusService statusService)
        {
            _settings = settings;
            _navigationService = navigationService;
            _messageHub = messageHub;
            _statusService = statusService;

            _statusService.Title = "Searches";
            _settings.SelectedInstance = null;
            SearchCommand = new DelegateCommand(Search);
            SettingsCommand = new DelegateCommand(Settings);
            SearchQueryCommand = new AsyncDelegateCommand<string>(SearchQuery);
        }
Ejemplo n.º 36
0
 public RetunedOrderDetailLinesPageViewModel()
 {
     ShowHeaderFrame           = true;
     ShowLines                 = true;
     ToggleHeaderFrameCommand  = new RelayCommand <bool>((b => ShowHeaderFrame = b));
     ToggleLinesCommand        = new RelayCommand <bool>((b => ShowLines = b));
     DownloadPdfCommand        = new AsyncDelegateCommand(OnDownloadPdf);
     ViewPdfCommand            = new AsyncDelegateCommand(OnViewPdf);
     ViewInvoiceCommand        = new AsyncDelegateCommand <Invoice>(OnViewInvoice);
     ViewPackingSlipCommand    = new AsyncDelegateCommand <PackingSlip>(OnViewPackingSlip);
     ToggleActionsFrameCommand = new Command <bool>((isExpanded) => ShowActionsFrame = isExpanded);
     ShowTrackingButton        = Settings.AccountPermissions["Show Rack Tracking"];
 }
Ejemplo n.º 37
0
 public DataController(ISettingsService settingsService, IDataService dataService, INetworkInfoService networkInfoService,
                       IWebStorageService webStorageService, IMessageService messageService)
 {
     appSettings                        = settingsService.Get <AppSettings>();
     this.dataService                   = dataService;
     this.networkInfoService            = networkInfoService;
     this.webStorageService             = webStorageService;
     this.messageService                = messageService;
     signInCommand                      = new AsyncDelegateCommand(SignIn, () => isInitialized);
     signOutCommand                     = new AsyncDelegateCommand(SignOutAsync);
     loadCompletion                     = new TaskCompletionSource <FeedManager>();
     webStorageService.PropertyChanged += WebStorageServicePropertyChanged;
 }
        public DetailsPageViewModel(ApplicationSettings settings, INavigationService navigationService, IHub messageHub, IShareDataRequestedPump shareMessagePump, IStatusService statusService)
        {
            _settings = settings;
            _navigationService = navigationService;
            _messageHub = messageHub;
            _shareMessagePump = shareMessagePump;
            _statusService = statusService;

            statusService.Title = _settings.SelectedImage.Title;
            _shareMessagePump.DataToShare = _settings.SelectedImage;

            BackCommand = _navigationService.GoBackCommand;
            SaveCommand = new AsyncDelegateCommand(Save);
            SetLockScreenCommand = new AsyncDelegateCommand(SetLockScreen);
            SetTileCommand = new DelegateCommand(SetTile);
            ShareCommand = new DelegateCommand(Share);
            SettingsCommand = new DelegateCommand(Settings);
        }
Ejemplo n.º 39
0
 public OldMainViewModel(IWeatherService service)
 {
     this.service = service;
     this.City = new ReactiveProperty<string>();
     this.Temperature = new ReactiveProperty<string>();
     this.Wind = new ReactiveProperty<string>();
     this.Humidity = new ReactiveProperty<string>();
     this.ImageResource = new ReactiveProperty<string>();
     this.PreviousImageResource = new ReactiveProperty<string>();
     this.CurrentImageResource = new ReactiveProperty<string>();
     this.NextImageResource = new ReactiveProperty<string>();
     this.PreviousName = new ReactiveProperty<string>();
     this.CurrentName = new ReactiveProperty<string>();
     this.NextName = new ReactiveProperty<string>();
     this.Phrase = new ReactiveProperty<string>("loading\n<red>f*****g</red>\nweather...");
     this.IsLoading = new ReactiveProperty<bool>();
     this.RefreshCommand = new AsyncDelegateCommand(_ => this.Reload());
 }
Ejemplo n.º 40
0
 public NewMainViewModel(IWeatherService service, IResources resources)
 {
     this.service = service;
     this.resources = resources;
     this.City = new ReactiveProperty<string>();
     this.Temperature = new ReactiveProperty<string>();
     this.Wind = new ReactiveProperty<string>();
     this.Humidity = new ReactiveProperty<string>();
     this.ImageResource = new ReactiveProperty<string>();
     this.PreviousImageResource = new ReactiveProperty<string>();
     this.CurrentImageResource = new ReactiveProperty<string>();
     this.NextImageResource = new ReactiveProperty<string>();
     this.PreviousName = new ReactiveProperty<string>();
     this.CurrentName = new ReactiveProperty<string>();
     this.NextName = new ReactiveProperty<string>();
     this.Phrase = new ReactiveProperty<string>(this.resources.LoadingPhrase);
     this.IsLoading = new ReactiveProperty<bool>();
     this.RefreshCommand = new AsyncDelegateCommand(_ => this.Reload());
 }
Ejemplo n.º 41
0
        /// <summary>
        /// Constructor. Resolve IoC dependencies, create the menu and the commands
        /// </summary>
        public MainViewModel()
        {
            // Resolve Ioc dependencies
            using (ILifetimeScope scope = ViewModelLocator.Container.BeginLifetimeScope())
            {
                _modelConference = scope.Resolve<IReadableLimitable<Conference>>();
                _modelMember = scope.Resolve<IReadableMember>();
                _modelNews = scope.Resolve<IReadableLimitable<News>>();
                _modelConference = scope.Resolve<IReadableLimitable<Conference>>();
                _modelProject = scope.Resolve<IReadableLimitable<Project>>();
                _modelShow = scope.Resolve<IReadableLimitable<Show>>();
            }

            // Create the menu
            Menu = new VisualMenu
                {
                    Groups = new ObservableCollection<VisualGenericGroup>
                        {
                            new VisualGenericGroup {Title = AppResourcesHelper.GetString("LBL_NEWS")},
                            new VisualGenericGroup {Title = AppResourcesHelper.GetString("LBL_BUREAU")},
                            new VisualGenericGroup {Title = AppResourcesHelper.GetString("LBL_PROJECTS")},
                            new VisualGenericGroup {Title = AppResourcesHelper.GetString("LBL_CONFERENCES")},
                            new VisualGenericGroup {Title = AppResourcesHelper.GetString("LBL_SALONS")}
                        }
                };

            // Create commands
            LoadMenuCommand = new AsyncDelegateCommand(LoadMenuAsync);
            LoadMoreItemsCommand = new AsyncDelegateCommand<string>(LoadMoreItemsAsync);

            GoToMasterPageCommand = new RelayCommand<VisualGenericGroup>(GoToMasterPage);
            GoToDetailsPageCommand = new RelayCommand<VisualGenericItem>(GoToDetailsPage);
            GoToAboutPageCommand = new RelayCommand<object>(GoToAboutPage);

            GoToSocialPageCommand = new RelayCommand<Uri>(GoToSocialNetworkPage);
            PinCommand = new RelayCommand<PinnableObject>(Pin);
        }
Ejemplo n.º 42
0
        public MainViewModel(IProgressAggregator progress) : base(progress)
        {
            _sceneRenderer = new SceneRenderer();
            RenderWidth = 400;
            RenderHeight = 300;

            RenderCommand = new AsyncDelegateCommand(Render);
            AnimateCommand = new AsyncDelegateCommand(Animate);

            RenderParameters = new ParameterBinding(UiDispatcher);
            AnimationParameters = new ParameterBinding(UiDispatcher);
        }