public DictionariesList_ViewModel(
            ILogger Logger_, 
            INavigationService NavigationService_, 
            IDialogService DialogService_,
            EFDbConnect EFDbConnect
            ) : base ()
        {
            NavigationService = NavigationService_;

            if (IsInDesignModeNet())
            {
                Dictionaries = new ObservableCollection<Dictionary>();

                Dictionary dic1 = new Dictionary { Name = "First" };
                Dictionaries.Add(dic1);

                Dictionary dic2 = new Dictionary { Name = "Second" };
                Dictionaries.Add(dic2);
            }
            else
            {
                List<Dictionary> dcts = EFDbContext.Context.Query(new QueryBuilder<Dictionary>(EFDbConnect));
                Dictionaries = new ObservableCollection<Dictionary>(dcts);
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
                OpenDictionary_Command = new MvxCommand<Dictionary>(OpenDictionary);
            }
        }
 public FavoritesViewModel(IFavoritesService favoritesService, IDialogService dialogService, INavigationService navigationService)
 {
     _favoritesService = favoritesService;
     _dialogService = dialogService;
     _navigationService = navigationService;
     Init();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="PluginsController" /> class.
        /// </summary>
        /// <param name="fileSystem">The file system.</param>
        /// <param name="pluginsService">The plugins service.</param>
        /// <param name="nugetService">The nuget service.</param>
        /// <param name="visualStudioService">The visual studio service.</param>
        /// <param name="readMeService">The read me service.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="messageBoxService">The message box service.</param>
        /// <param name="dialogService">The dialog service.</param>
        /// <param name="formsService">The forms service.</param>
        /// <param name="translator">The translator.</param>
        public PluginsController(
            IFileSystem fileSystem,
            IPluginsService pluginsService,
            INugetService nugetService,
            IVisualStudioService visualStudioService,
            IReadMeService readMeService,
            ISettingsService settingsService,
            IMessageBoxService messageBoxService,
            IDialogService dialogService,
            IFormsService formsService,
            ITranslator<Tuple<DirectoryInfoBase, DirectoryInfoBase>, Plugins> translator)
            : base(visualStudioService, 
            readMeService, 
            settingsService, 
            messageBoxService,
            dialogService,
            formsService)
        {
            TraceService.WriteLine("PluginsController::Constructor");

            this.fileSystem = fileSystem;
            this.pluginsService = pluginsService;
            this.nugetService = nugetService;
            this.translator = translator;
        }
 public SignInWizzardPageViewModel()
 {
     m_authenticationService = AuthenticationService.Instance;
     m_dialogSService = DialogService.Instance;
     m_settingsService = SettingsService.Instance;
     UserName = m_settingsService.User?.UserName; 
 }
        public MainWindowViewModel(IDialogService dialogService)
        {
            this.dialogService = dialogService;

            ImplicitShowDialogCommand = new RelayCommand(ImplicitShowDialog);
            ExplicitShowDialogCommand = new RelayCommand(ExplicitShowDialog);
        }
Example #6
0
        public DocumentViewModel(
            IDialogService dialogService,
            IWindowManager windowManager,
            ISiteContextGenerator siteContextGenerator,
            Func<string, IMetaWeblogService> getMetaWeblog,
            ISettingsProvider settingsProvider,
            IDocumentParser documentParser)
        {
            this.dialogService = dialogService;
            this.windowManager = windowManager;
            this.siteContextGenerator = siteContextGenerator;
            this.getMetaWeblog = getMetaWeblog;
            this.settingsProvider = settingsProvider;
            this.documentParser = documentParser;

            FontSize = GetFontSize();

            title = "New Document";
            Original = "";
            Document = new TextDocument();
            Post = new Post();
            timer = new DispatcherTimer();
            timer.Tick += TimerTick;
            timer.Interval = delay;
        }
Example #7
0
 public MainViewModel(IDialogService dialogService, IErrorService errorService)
 {
     _dialogService = dialogService;
     _errorService = errorService;
     OpenFileCommand = new RelayCommand(OpenFile);
     _showScoreInfoCommand = new RelayCommand(ShowScoreInfo, () => _score != null);
 }
        public ViewModelBase(IPersonService personService, IDispatcher dispatcher, IEventAggregator aggregator, IDialogService dialogService)
        {
            if (personService == null)
            {
                throw new ArgumentNullException("personService");
            }

            if (dispatcher == null)
            {
                throw new ArgumentNullException("dispatcher");
            }

            if (aggregator == null)
            {
                throw new ArgumentNullException("aggregator");
            }

            if (dialogService == null)
            {
                throw new ArgumentNullException("dialogService");
            }

            this.personService = personService;
            this.dispatcher = dispatcher;
            this.aggregator = aggregator;
            this.dialogService = dialogService;

            isBusy = false;
        }
Example #9
0
        public OrgStructureViewModel(string siteUrl,string subSiteUrl, StringBuilder log, string mainCheckListName)
        {
            _log = log;
            _dispatcher = Deployment.Current.Dispatcher;
            _OrgStructureServiceAgent = new OrgStructureServiceAgent(siteUrl, log);
            _mainCheckListName = mainCheckListName;
            _subSiteUrl = subSiteUrl;
            Levels = new ObservableCollection<OrgStructureEntityModel>();


            AddCommand = new RelayCommand(AddAction);
            AddCommand.IsEnabled = false;

            EditCommand = new RelayCommand(EditAction);
            EditCommand.IsEnabled = false;

            DeleteCommand = new RelayCommand(DeleteAction);
            DeleteCommand.IsEnabled = false;

            AddGlobalCommand = new RelayCommand(AddGlobalAction);
            AddGlobalCommand.IsEnabled = true;

            CancelCommand = new RelayCommand(CancelAction);
            CancelCommand.IsEnabled = true;

            _confirmDialog = new DialogService(340, 120);
            
            LoadOrgStructureEntityModel();

        }
        public ClientViewModel(
            IAsyncRequestDispatcherFactory asyncRequestDispatcherFactory,
            IDialogService dialogService,
            IAddClientViewModel addClientViewModel,
            IAddPositionViewModel addPositionViewModel,
            IAddIndustryViewModel addIndustryViewModel)
        {
            _asyncRequestDispatcherFactory = asyncRequestDispatcherFactory;
            _dialogService = dialogService;
            _addClientViewModel = addClientViewModel;
            _addPositionViewModel = addPositionViewModel;
            _addIndustryViewModel = addIndustryViewModel;

            _addClientRequest = new InteractionRequest<ResponseNotification>();
            _addPositionRequest = new InteractionRequest<ResponseNotification>();
            _addIndustryRequest = new InteractionRequest<ResponseNotification>();

            AddClientCommand = new DelegateCommand(AddClient);
            RemoveClientCommand = new DelegateCommand(RemoveClient);
            AddPositionCommand = new DelegateCommand(AddPosition);
            RemovePositionCommand = new DelegateCommand(RemovePosition);
            AddIndustryCommand = new DelegateCommand(AddIndustry);
            RemoveIndustryCommand = new DelegateCommand(RemoveIndustry);
            EditClientCommand = new DelegateCommand<ClientModel>(EditClient);
        }
Example #11
0
 public ImportService(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IAnalysisService analysisService)
 {
     _projectService = projectService;
     _dialogService = dialogService;
     _busyService = busyService;
     _analysisService = analysisService;
 }
 public CategoryDialogViewModel(IRepository<Category> categoryRepository, IDialogService dialogService,
     SettingsCategoryListViewModel categoryListViewModel)
 {
     this.categoryRepository = categoryRepository;
     this.dialogService = dialogService;
     this.categoryListViewModel = categoryListViewModel;
 }
        public ProposalsListViewModel(
            [Import]IBackgroundExecutor executor,
            [Import]IEventAggregator eventAggregator,
            [Import]IDialogService dialogs,
            [Import]IAuthorizationService authorizator,
            [Import]IBacklogService backlogService,
            [Import]IProposalsService proposalsService)
        {
            this.executor = executor;
                this.dialogs = dialogs;
                this.aggregator = eventAggregator;

                this.authorizator = authorizator;
                this.proposalsService = proposalsService;
                this.backlogService = backlogService;

                this.aggregator.Subscribe<Project>(ScrumFactoryEvent.ViewProjectDetails, OnViewProjectDetails);

                this.aggregator.Subscribe(ScrumFactoryEvent.RoleHourCostsChanged, LoadProposals);
                this.aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);

                this.aggregator.Subscribe(ScrumFactoryEvent.ApplicationWhentBackground, () => { ShowValues = false; });

                OnLoadCommand = new DelegateCommand(CanSeeProposals, () => {
                    ShowValues = false;
                    if (NeedRefresh) LoadProposals();
                });
                AddProposalCommand = new DelegateCommand(CanSeeProposals, AddProposal);
                ShowDetailCommand = new DelegateCommand<Proposal>(CanSeeProposals, ShowDetail);
                ShowHourCostsCommand = new DelegateCommand(CanSeeProposals, ShowHourCosts);
        }
		public PersonDirectoryViewModel(IPersonService personService, IDispatcher dispatcher, IEventAggregator aggregator, IDialogService dialogService) 
			: base(personService, dispatcher, aggregator, dialogService)
		{
			personDirectory = new RangeEnabledObservableCollection<Person>();
			aggregator.GetEvent<PersonDirectoryUpdatedEvent>().Subscribe(OnPersonDirectoryUpdated, ThreadOption.BackgroundThread);
			aggregator.GetEvent<PersonDeletedEvent>().Subscribe(OnPersonDeleted, ThreadOption.UIThread);
		}
 public OpenFileTabContentViewModel(IDialogService dialogService)
 {
     this.dialogService = dialogService;
     
     openFileCommand = ReactiveCommand.Create();
     openFileCommand.Subscribe(_ => OpenFile());
 }
        public PasswordEditorViewModel( IPasswordEditorModel model,
                                        DerivedPasswordViewModel.Factory derivedPasswordFactory,
                                        IExclusiveDelayedScheduler scheduler,
                                        IClipboardService clipboardService,
                                        IDialogService dialogService,
                                        IGuidToColorConverter guidToColor )
        {
            _model = model;
            _scheduler = scheduler;
            _clipboardService = clipboardService;
            _dialogService = dialogService;
            _guidToColor = guidToColor;
            _derivedPasswords = new ObservableCollection<DerivedPasswordViewModel>(
                _model.DerivedPasswords.Select( dp => derivedPasswordFactory( dp, _model ) ) );

            foreach ( DerivedPasswordViewModel passwordSlotViewModel in DerivedPasswords )
                passwordSlotViewModel.PropertyChanged += OnDerivedPasswordPropertyChanged;

            _saveCommand = new RelayCommand( ExecuteSave, CanExecuteSave );
            _copyCommand = new RelayCommand( ExecuteCopy, CanExecuteCopy );
            _deleteCommand = new RelayCommand( ExecuteDelete, CanExecuteDelete );

            _closeSelfCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.Self ) );
            _closeAllCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.All ) );
            _closeAllButSelfCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.AllButSelf ) );
            _closeToTheRightCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.RightOfSelf ) );
            _closeInsecureCommand = new RelayCommand( ( ) => RaiseCloseRequested( CloseEditorEventType.Insecure ) );

            Refresh( );
        }
        public OwnersListViewModel(
            [Import]IEventAggregator eventAggregator,
            [Import]ITeamService teamServices,
            [Import]IBackgroundExecutor backgroundExecutor,
            [Import] IDialogService dialogs,
            [Import]IAuthorizationService authorizationService)
        {
            this.aggregator = eventAggregator;

            this.teamServices = teamServices;
            this.executor = backgroundExecutor;
            this.authorizator = authorizationService;
            this.dialogs = dialogs;

            aggregator.Subscribe(ScrumFactoryEvent.ShowOwnersList, Show);

            CloseWindowCommand = new DelegateCommand(CloseWindow);
            OnLoadCommand = new DelegateCommand(LoadOwners);

            ChangeFactoryOwnerCommand = new DelegateCommand<string>(ChangeFactoryOwner);
            ChangeCanSeeProposalsCommand = new DelegateCommand<string>(ChangeCanSeeProposals);

            AddNewMemberCommand = new DelegateCommand(AddNewMember);

            RefreshMemberFilter = LoadMembers;
        }
 public LoginViewModel(IAuthenticationService authenticationService, IAppSettings appSettings, IDialogService dialogService, IStatisticsService statisticsService)
 {
     _authenticationService = authenticationService;
     _appSettings = appSettings;
     _dialogService = dialogService;
     _statisticsService = statisticsService;
 }
Example #19
0
 public PlayerManager(IDataService dataService, IAccountService accountService, IPlayerService playerService, IDialogService dialogservice, IResourceService resourceService)
 {
     this.m_dataService = dataService;
     this.m_accountService = accountService;
     this.PlayerService = playerService;
     this.m_dialogService = dialogservice;
     this.m_resourceService = resourceService;
     Messenger.Default.Register<MediaOpenedMessage>(this, message =>
     {
         this.OnMediaOpened();
     });
     Messenger.Default.Register<MediaEndedMessage>(this, message =>
     {
         this.OnMediaEnded();
     });
     Messenger.Default.Register<MediaNextPressedMessage>(this, message =>
     {
         if (this.CanExecuteNextTrack())
         {
             this.ExecuteNextTrack();
         }
     });
     Messenger.Default.Register<MediaPreviousPressedMessage>(this, message =>
     {
         if (this.CanExecutePreviousTrack())
         {
             this.ExecutePreviousTrack();
         }
     });
 }
 public FolderBrowserTabContentViewModel(IDialogService dialogService)
 {
     this.dialogService = dialogService;
     
     browseFolderCommand = ReactiveCommand.Create();
     browseFolderCommand.Subscribe(_ => BrowseFolder());
 }
 public BasePlaylistableViewModel(IDataService dataService, IAccountService accountService, IDialogService dialogService, IResourceService resourceService)
 {
     this.DataService = dataService;
     this.AccountService = accountService;
     this.DialogService = dialogService;
     this.ResourceService = resourceService;
 }
Example #22
0
        public GeographicalViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService, IImageExportService imageExportService,
			GeographicalVarietyViewModel.Factory varietyFactory)
            : base("Geographical")
        {
            _projectService = projectService;
            _dialogService = dialogService;
            _importService = importService;
            _imageExportService = imageExportService;
            _varietyFactory = varietyFactory;

            _newRegionCommand = new RelayCommand<IEnumerable<Tuple<double, double>>>(AddNewRegion);
            _currentClusters = new List<Cluster<Variety>>();

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg => ClusterVarieties());
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
                {
                    if (msg.AffectsComparison)
                        ResetClusters();
                    if (_selectedRegion != null && (!_varieties.Contains(_selectedRegion.Variety) || !_selectedRegion.Variety.Regions.Contains(_selectedRegion)))
                        SelectedRegion = null;
                });
            Messenger.Default.Register<PerformingComparisonMessage>(this, msg => ResetClusters());

            _similarityScoreThreshold = 0.7;

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Similarity metric",
                new TaskAreaCommandViewModel("Lexical", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Lexical)),
                new TaskAreaCommandViewModel("Phonetic", new RelayCommand(() => SimilarityMetric = SimilarityMetric.Phonetic))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Import regions", new RelayCommand(ImportRegions)),
                new TaskAreaCommandViewModel("Export this map", new RelayCommand(Export))));
        }
 public SignOutSettingsPageViewModel()
 {
     m_authenticationHandler = AuthenticationService.Instance;
     m_dialogSService = DialogService.Instance;
     m_settingsService = SettingsService.Instance;
     UserName = m_settingsService.User?.UserName; 
 }
        public AppSettingEdit_ViewModel_WPF(
            ILogger Logger_, 
            INavigationService NavigationService_, 
            IDialogService DialogService_,
            EFDbConnect EFDbConnect_)
        {

            if (!IsInDesignModeNet())
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                EFDbConnect = EFDbConnect_;

                Languages = new ObservableCollection<Language>(EFDbConnect.Table<Language>().ToList()); 
                LearningWordStrategies = new ObservableCollection<LearningWordStrategy>(EFDbConnect.Table<LearningWordStrategy>().ToList());

                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);
            }

            if (IsInDesignModeNet())
            {
                Languages = new ObservableCollection<Language>();
                Languages.Add(new Language() {Code="en",Name="English"});
                Languages.Add(new Language() {Code="ru",Name="Русский"});
                Languages.Add(new Language() {Code="ua",Name="Українська мова"});

                Languages[0].DictionariesCollection.Add(new Dictionary {Name="First dictionary" });
                Languages[0].DictionariesCollection.Add(new Dictionary {Name="Ordinary dict" });
                Languages[0].DictionariesCollection.Add(new Dictionary {Name="My dictionary" });

                CurrentLanguage = Languages[0];
            }

        }
        public AppSettingEdit_ViewModel(ILogger Logger_, INavigationService NavigationService_, IDialogService DialogService_, ITranslate TranslateService_)
        {

            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;

                Languages = ViewModelLocator.Instance.Languages;
                LearningWordStrategies = new ObservableCollection<LearningWordStrategy>(ViewModelLocator.Instance.DataBase.Set<LearningWordStrategy>().ToList());
            }
            
            CommandDispatcher = new RelayCommand<string>(CmdDispatcher);

            if (IsInDesignMode)
            {
                Languages = new ObservableCollection<Language>();
                Languages.Add(new Language() {Code="en",Name="English"});
                Languages.Add(new Language() {Code="ru",Name="Русский"});
                Languages.Add(new Language() {Code="ua",Name="Українська мова"});

                Languages[0].DictionariesCollection.Add(new Dictionary {name="First dictionary" });
                Languages[0].DictionariesCollection.Add(new Dictionary {name="Ordinary dict" });
                Languages[0].DictionariesCollection.Add(new Dictionary {name="My dictionary" });

                CurrentLanguage = Languages[0];
            }

        }
Example #26
0
 /// <summary>
 /// Initializes a new instance of the TaskViewModel class.
 /// </summary>
 public TaskViewModel(Task model, string listId, IDataService dataService, INavigationService navigationService, IDialogService dialogService)
     : base(dataService, navigationService, dialogService)
 {
     _model = model;
     _listId = listId;
     update();
 }
        public OpenDatabaseViewModel(
            INavigationService navigationService,
            IDatabaseInfoRepository databaseInfoRepository,
            ICanSHA256Hash hasher,
            IDialogService dialogService,
            IPWDatabaseDataSource databaseSource,
            ICache cache)
        {
            _cache = cache;
            _databaseSource = databaseSource;
            _dialogService = dialogService;
            _databaseInfoRepository = databaseInfoRepository;
            _hasher = hasher;
            _navigationService = navigationService;
            var canHitOpen = this.WhenAny(
                vm => vm.Password, 
                vm => vm.KeyFileName,
                (p, k) => !string.IsNullOrEmpty(p.Value) || !string.IsNullOrEmpty(k.Value));

            OpenCommand = new ReactiveCommand(canHitOpen);
            OpenCommand.Subscribe(OpenDatabase);

            GetKeyFileCommand = new ReactiveCommand();
            GetKeyFileCommand.Subscribe(GetKeyFile); 
            
            ClearKeyFileCommand = new ReactiveCommand();
            ClearKeyFileCommand.Subscribe(ClearKeyFile);

            IObservable<string> keyFileNameChanged = this.WhenAny(vm => vm.KeyFileName, kf => kf.Value);
            keyFileNameChanged.Subscribe(v => ClearKeyFileButtonIsVisible = !string.IsNullOrWhiteSpace(v));
            keyFileNameChanged.Subscribe(v => GetKeyFileButtonIsVisible = string.IsNullOrWhiteSpace(v));
        }
        public AuthenticateDialogViewModel(ICrunchFacade crunchFacade, IDialogService dialogService)
        {
            _crunchFacade = crunchFacade;
            _dialogService = dialogService;

            Title = "Connect to Crunch";
        }
 public BackupViewModel(IBackupManager backupManager,
     IDialogService dialogService, IConnectivity connectivity)
 {
     this.backupManager = backupManager;
     this.dialogService = dialogService;
     this.connectivity = connectivity;
 }
Example #30
0
        public MemberViewModel(
            [Import(typeof(IAuthorizationService))] IAuthorizationService authorizator,
            [Import(typeof(IBackgroundExecutor))] IBackgroundExecutor executor,
            [Import(typeof(IEventAggregator))] IEventAggregator aggregator,
            [Import] IDialogService dialogs,
            [Import(typeof(ITasksService))] ITasksService taskService,
            [Import(typeof(ITeamService))] ITeamService teamService)
        {
            this.taskService = taskService;
            this.authorizator = authorizator;
            this.executor = executor;
            this.aggregator = aggregator;
            this.teamService = teamService;
            this.dialogs = dialogs;

            aggregator.Subscribe(ScrumFactoryEvent.ShowProfile, Show);
            aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);

            ChangeAvatarCommand = new DelegateCommand(ChangeMemberImage);
            RemoveAvatarCommand = new DelegateCommand(RemoveMemberImage);
            CloseWindowCommand = new DelegateCommand(Close);
            CreateAvatarCommand = new DelegateCommand(CreateAvatar);

            UpdateAvatarCommand = new DelegateCommand(() => {
                executor.StartBackgroundTask(
                () => {
                    teamService.UpdateMember(authorizator.SignedMemberProfile.MemberUId, MemberProfile);
                }, () => {
                    myProfileNocache = new Random().Next().ToString();
                    DefineMemberAvatarUrl();
                });
            });
        }
 public PaymentFormViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService, IConfigurationService config) : base(string.Empty, dataServices, region, manager, dialogService, config)
 {
     GridIdentifier = KarveCommon.Generic.GridIdentifiers.PaymentFormGrid;
 }
Example #32
0
 public EditClientViewModel(IDataService <Client> dataService, IDialogService dialogService)
     : base(dataService, dialogService)
 {
 }
Example #33
0
 public PlayerDetailsViewModel(IPlayerService playerService, IDialogService dialogService, ICacheService cacheService)
 {
     _playerService = playerService;
     _dialogService = dialogService;
     _cacheService  = cacheService;
 }
 public InventoryViewModel(INavigationService navigationService, IDialogService dialogService) : base(navigationService, dialogService)
 {
 }
Example #35
0
        public ShellViewModel(IPlaybackService playbackService, ITaskbarService taskbarService, IDialogService dialogService,
                              IJumpListService jumpListService, IFileService fileService, IUpdateService updateService)
        {
            this.TaskbarService = taskbarService;

            dialogService.DialogVisibleChanged += isDialogVisible => { this.IsOverlayVisible = isDialogVisible; };

            this.PlayPreviousCommand = new DelegateCommand(async() => await playbackService.PlayPreviousAsync());
            this.PlayNextCommand     = new DelegateCommand(async() => await playbackService.PlayNextAsync());
            this.PlayOrPauseCommand  = new DelegateCommand(async() => await playbackService.PlayOrPauseAsync());

            this.LoadedCommand = new DelegateCommand(() => fileService.ProcessArguments(Environment.GetCommandLineArgs()));

            // Populate the JumpList
            jumpListService.PopulateJumpListAsync();
        }
 public ProjetoItemDialogPageViewModel(IDialogService dialogService = null)
 {
     _dialogService = dialogService;
 }
Example #37
0
        public SettingsOnlineViewModel(IContainerProvider container, IProviderService providerService, IDialogService dialogService, IScrobblingService scrobblingService, IEventAggregator eventAggregator)
        {
            this.container         = container;
            this.providerService   = providerService;
            this.dialogService     = dialogService;
            this.scrobblingService = scrobblingService;
            this.eventAggregator   = eventAggregator;

            this.scrobblingService.SignInStateChanged += (_) =>
            {
                this.IsLastFmSigningIn = false;
                RaisePropertyChanged(nameof(this.IsLastFmSignedIn));
                RaisePropertyChanged(nameof(this.LastFmUsername));
                RaisePropertyChanged(nameof(this.IsLastFmSignInError));
            };

            this.AddCommand          = new DelegateCommand(() => this.AddSearchProvider());
            this.EditCommand         = new DelegateCommand(() => { this.EditSearchProvider(); }, () => { return(this.SelectedSearchProvider != null); });
            this.RemoveCommand       = new DelegateCommand(() => { this.RemoveSearchProvider(); }, () => { return(this.SelectedSearchProvider != null); });
            this.LastfmSignInCommand = new DelegateCommand(async() =>
            {
                this.IsLastFmSigningIn = true;
                await this.scrobblingService.SignIn();
            });
            this.LastfmSignOutCommand       = new DelegateCommand(() => this.scrobblingService.SignOut());
            this.CreateLastFmAccountCommand = new DelegateCommand(() =>
            {
                try
                {
                    Actions.TryOpenLink(Constants.LastFmJoinLink);
                }
                catch (Exception ex)
                {
                    LogClient.Error("Could not open the Last.fm web page. Exception: {0}", ex.Message);
                }
            });

            this.GetSearchProvidersAsync();

            this.providerService.SearchProvidersChanged += (_, __) => this.GetSearchProvidersAsync();

            this.GetCheckBoxesAsync();
            this.GetTimeoutsAsync();
        }
 public DeckViewModel(IDeckService deckService, INavigationService navigationService, IDialogService dialog)
 {
     _deckService       = deckService;
     _navigationService = navigationService;
     _dialog            = dialog;
 }
Example #39
0
        protected BaseViewModel()
        {
            IsBusy = false;

            _dialogService = new DialogService();
        }
 public SshHelperService(IDialogService dialogService) => _dialogService = dialogService;
Example #41
0
 /// <summary>
 ///  CompanyCardViewModel
 /// </summary>
 /// <param name="dataServices">DataServices</param>
 /// <param name="region">Region</param>
 /// <param name="manager">EventManager</param>
 public CompanyCardViewModel(IDataServices dataServices, IRegionManager region, IEventManager manager, IDialogService dialogService) : base(String.Empty, dataServices, region, manager, dialogService)
 {
     GridIdentifier = KarveCommon.Generic.GridIdentifiers.HelperCompanyCard;
 }
        public ExchangeBillPageViewModel(INavigationService navigationService,
                                         IExchangeBillService exchangeBillService,
                                         IProductService productService,
                                         IUserService userService,
                                         ITerminalService terminalService,
                                         IWareHousesService wareHousesService,
                                         IAccountingService accountingService,
                                         IMicrophoneService microphoneService,
                                         ISaleBillService saleBillService,
                                         //IMapper mapper,
                                         IDialogService dialogService
                                         ) : base(navigationService,
                                                  productService, terminalService,
                                                  userService, wareHousesService,
                                                  accountingService, dialogService)
        {
            Title = "换货单";

            _saleBillService     = saleBillService;
            _exchangeBillService = exchangeBillService;
            _microphoneService   = microphoneService;
            //_mapper = mapper;

            InitBill();

            #region //配送日期指定
            var weekDays  = new List <WeekDay>();
            var startTime = DateTime.Now;
            var endTime   = DateTime.Now.AddDays(7);
            while (endTime.Subtract(startTime).Days > 0)
            {
                var wd = new WeekDay
                {
                    Wname           = $"{startTime:MM-dd} - {GlobalSettings.GetWeek(startTime.DayOfWeek.ToString())}",
                    Date            = startTime,
                    AMTimeRange     = $"09:00-12:00",
                    PMTimeRange     = $"15:00-21:00",
                    SelectedCommand = ReactiveCommand.Create <WeekDay>(r =>
                    {
                        this.WeekDays.ForEach(s => { s.Selected = false; });
                        r.Selected       = !r.Selected;
                        this.DeliverDate = r;
                        this.AMTimeRange = r.AMTimeRange;
                        this.PMTimeRange = r.PMTimeRange;
                    })
                };
                weekDays.Add(wd);
                startTime = startTime.AddDays(1);
            }
            var defaultWd = weekDays.FirstOrDefault();
            if (defaultWd != null)
            {
                defaultWd.Selected = true;
                this.AMTimeRange   = defaultWd.AMTimeRange;
                this.PMTimeRange   = defaultWd.PMTimeRange;
            }
            this.WeekDays = new ObservableCollection <WeekDay>(weekDays);

            #endregion

            //验证
            var valid_IsReversed     = this.ValidationRule(x => x.Bill.ReversedStatus, _isBool, "已红冲单据不能操作");
            var valid_IsAudited      = this.ValidationRule(x => x.Bill.AuditedStatus, _isBool, "已审核单据不能操作");
            var valid_TerminalId     = this.ValidationRule(x => x.Bill.TerminalId, _isZero, "客户未指定");
            var valid_BusinessUserId = this.ValidationRule(x => x.Bill.DeliveryUserId, _isZero, "配送员未指定");
            var valid_WareHouseId    = this.ValidationRule(x => x.Bill.WareHouseId, _isZero, "仓库未指定");
            var valid_ProductCount   = this.ValidationRule(x => x.Bill.Items.Count, _isZero, "请添加商品项目");

            //添加商品
            this.AddProductCommand = ReactiveCommand.Create <object>(async e =>
            {
                if (this.Bill.AuditedStatus && !this.ReferencePage.Equals("UnDeliveryPage"))
                {
                    _dialogService.ShortAlert("已审核单据不能操作");
                    return;
                }

                if (!valid_TerminalId.IsValid)
                {
                    _dialogService.ShortAlert(valid_TerminalId.Message[0]);
                    ((ICommand)CustomSelected)?.Execute(null);
                    return;
                }

                if (!valid_WareHouseId.IsValid)
                {
                    _dialogService.ShortAlert(valid_WareHouseId.Message[0]);
                    ((ICommand)StockSelected)?.Execute(null);
                    return;
                }

                if (!valid_BusinessUserId.IsValid)
                {
                    _dialogService.ShortAlert(valid_BusinessUserId.Message[0]);
                    ((ICommand)DeliverSelected)?.Execute(null);
                    return;
                }

                //转向商品选择
                await this.NavigateAsync("SelectProductPage", ("Reference", this.PageName),
                                         ("WareHouse", WareHouse),
                                         ("TerminalId", Bill.TerminalId),
                                         ("Terminaler", this.Terminal),
                                         ("SerchKey", Filter.SerchKey));
            });

            //编辑商品
            this.WhenAnyValue(x => x.Selecter).Throttle(TimeSpan.FromMilliseconds(500))
            .Skip(1)
            .Where(x => x != null)
            .SubOnMainThread(async item =>
            {
                if (this.Bill.ReversedStatus)
                {
                    _dialogService.ShortAlert("已红冲单据不能操作");
                    return;
                }

                if (this.Bill.AuditedStatus)
                {
                    _dialogService.ShortAlert("已审核单据不能操作");
                    return;
                }

                if (this.Bill.IsSubmitBill)
                {
                    _dialogService.ShortAlert("已提交的单据不能编辑");
                    return;
                }

                if (item != null)
                {
                    var product = ProductSeries.Select(p => p).Where(p => p.Id == item.ProductId).FirstOrDefault();
                    if (product != null)
                    {
                        product.UnitId   = item.UnitId;
                        product.Quantity = item.Quantity;
                        product.Price    = item.Price;
                        product.Amount   = item.Amount;
                        product.Remark   = item.Remark;
                        product.Subtotal = item.Subtotal;
                        product.UnitName = item.UnitName;

                        if (item.BigUnitId > 0)
                        {
                            product.bigOption.Name        = item.UnitName;
                            product.BigPriceUnit.Quantity = item.Quantity;
                            product.BigPriceUnit.UnitId   = item.BigUnitId;
                            product.BigPriceUnit.Amount   = item.Amount;
                            product.BigPriceUnit.Remark   = item.Remark;
                        }

                        if (item.SmallUnitId > 0)
                        {
                            product.bigOption.Name          = item.UnitName;
                            product.SmallPriceUnit.Quantity = item.Quantity;
                            product.SmallPriceUnit.UnitId   = item.SmallUnitId;
                            product.SmallPriceUnit.Amount   = item.Amount;
                            product.SmallPriceUnit.Remark   = item.Remark;
                        }

                        await this.NavigateAsync("EditProductPage", ("Product", product), ("Reference", PageName), ("Item", item), ("WareHouse", WareHouse));
                    }
                }

                this.Selecter = null;
            })
            .DisposeWith(DeactivateWith);

            //提交表单
            this.SubmitDataCommand = ReactiveCommand.CreateFromTask <object, Unit>(async _ =>
            {
                return(await this.Access(AccessGranularityEnum.ExchangeBillsSave, async() =>
                {
                    if (this.Bill.ReversedStatus)
                    {
                        _dialogService.ShortAlert("已红冲单据不能操作");
                        return Unit.Default;
                    }

                    if (this.Bill.AuditedStatus || DispatchItem != null)
                    {
                        _dialogService.ShortAlert("已审核单据不能操作");
                        return Unit.Default;
                    }

                    //结算方式
                    Bill.PayTypeId = 0;
                    Bill.PayTypeName = "";

                    if (Bill.BusinessUserId == 0)
                    {
                        Bill.BusinessUserId = Settings.UserId;
                    }

                    var postMData = new ExchangeBillUpdateModel()
                    {
                        BillNumber = this.Bill.BillNumber,
                        //客户
                        TerminalId = Bill.TerminalId,
                        //业务员
                        BusinessUserId = Bill.BusinessUserId,
                        //送货员
                        DeliveryUserId = Bill.DeliveryUserId,
                        //仓库
                        WareHouseId = Bill.WareHouseId,
                        //交易日期
                        TransactionDate = DateTime.Now,
                        //默认售价方式
                        DefaultAmountId = Settings.DefaultPricePlan,
                        //备注
                        Remark = Bill.Remark,
                        //优惠金额
                        PreferentialAmount = 0,
                        //优惠后金额
                        PreferentialEndAmount = 0,
                        //欠款金额
                        OweCash = 0,
                        //商品项目
                        Items = Bill.Items,
                        //收款账户
                        //预收款
                        AdvanceAmount = 0,
                        //预收款余额
                        AdvanceAmountBalance = 0,
                        //配送时间
                        DeliverDate = this.DeliverDate?.Date ?? DateTime.Now,
                        AMTimeRange = this.DeliverDate?.AMTimeRange,
                        PMTimeRange = this.DeliverDate?.PMTimeRange
                    };


                    return await SubmitAsync(postMData, Bill.Id, _exchangeBillService.CreateOrUpdateAsync, async(result) =>
                    {
                        BillId = result.Code;
                        //清空单据
                        Bill = new ExchangeBillModel();


                        if (IsVisit) //拜访时开单
                        {
                            //转向拜访界面
                            await this.NavigateAsync("VisitStorePage", ("BillTypeId", BillTypeEnum.ExchangeBill),
                                                     ("BillId", BillId),
                                                     ("Amount", Bill.SumAmount));
                        }
                    }, !IsVisit, token: new System.Threading.CancellationToken());
                }));
            },
Example #43
0
        public MainWindowViewModel(IDialogService dialogService)
        {
            _dialogService = dialogService;

            NewProjectCommand = ReactiveCommand.CreateFromTask(CreateNewProject);
        }
 public AddQualificationViewModel(IDialogService dialogService, ICandidateDetailsService candidateDetailsService, INavigationService navigationService)
 {
     _dialogService           = dialogService;
     _candidateDetailsService = candidateDetailsService;
     _navigationService       = navigationService;
 }
Example #45
0
 public YtdlUpdateService(YoutubeDL ydl, IDialogService dialogService)
 {
     this.ydl           = ydl;
     this.dialogService = dialogService;
 }
Example #46
0
 protected BaseViewModel()
 {
     DialogService     = ViewModelLocator.Resolve <IDialogService>();
     NavigationService = ViewModelLocator.Resolve <INavigationService>();
 }
Example #47
0
 public GistsViewModel(IGistDataService gistDataService, IGithubClientService githubClientService, IMvxMessenger messenger, IDialogService dialogService) : base(githubClientService, messenger, dialogService)
 {
     _gistDataService = gistDataService;
 }
 public StatisticsViewModel(IGameSettings gameSettings, IDialogService dialogService)
 {
     _gameSettings      = gameSettings;
     _statisticsRecords = _gameSettings.Statistics;
     _dialogService     = dialogService;
 }
 public AuthorizationViewModel(IAuthorizationService authorizationService, IWindowFactory windowFactory, IDialogService dialogService)
 {
     _authorizationService = authorizationService;
     _windowFactory        = windowFactory;
     _dialogService        = dialogService;
     LogInCommand          = new DelegateCommandAsync(ExecutePrintResultAuthorization);
 }
Example #50
0
 protected BaseViewModel(INavigationService navigationService, IDialogService dialogService, IDatabaseService databaseService)
 {
     NavigationService = navigationService;
     DialogService     = dialogService;
     DatabaseService   = databaseService;
 }
Example #51
0
        public ProductArchivesPageViewModel(INavigationService navigationService,
                                            IProductService productService,
                                            IUserService userService,
                                            ITerminalService terminalService,
                                            IWareHousesService wareHousesService,
                                            IAccountingService accountingService,
                                            IDialogService dialogService
                                            ) : base(navigationService, productService, terminalService, userService, wareHousesService, accountingService, dialogService)
        {
            Title = "商品档案";

            _navigationService = navigationService;
            _dialogService     = dialogService;
            _terminalService   = terminalService;
            _productService    = productService;
            _userService       = userService;
            _wareHousesService = wareHousesService;
            _accountingService = accountingService;


            //搜索
            this.WhenAnyValue(x => x.Filter.SerchKey)
            .Where(s => !string.IsNullOrEmpty(s))
            .Select(s => s)
            .Throttle(TimeSpan.FromSeconds(2), RxApp.MainThreadScheduler)
            .Subscribe(s =>
            {
                ((ICommand)SerchCommand)?.Execute(s);
            }).DisposeWith(DeactivateWith);

            this.SerchCommand = ReactiveCommand.Create <string>(e =>
            {
                if (string.IsNullOrEmpty(Filter.SerchKey))
                {
                    this.Alert("请输入关键字!");
                    return;
                }
                ((ICommand)Load)?.Execute(null);
            });
            this.Load = ProductSeriesLoader.Load(async() =>
            {
                //重载时排它
                ItemTreshold = 1;

                var items = await GetProductsPage(0, PageSize);

                //清除列表
                ProductSeries?.Clear();

                if (items != null && items.Any())
                {
                    foreach (var item in items)
                    {
                        if (ProductSeries.Count(s => s.ProductId == item.ProductId) == 0)
                        {
                            ProductSeries.Add(item);
                        }
                    }
                }

                if (ProductSeries.Count > 0)
                {
                    this.ProductSeries = new System.Collections.ObjectModel.ObservableCollection <ProductModel>(ProductSeries);
                }

                return(ProductSeries);
            });
            //以增量方式加载数据
            this.ItemTresholdReachedCommand = ReactiveCommand.Create(async() =>
            {
                int pageIdex = ProductSeries.Count / PageSize;
                using (var dig = UserDialogs.Instance.Loading("加载中..."))
                {
                    try
                    {
                        var items            = await GetProductsPage(pageIdex, PageSize);
                        var previousLastItem = ProductSeries.Last();

                        if (items != null)
                        {
                            foreach (var item in items)
                            {
                                if (ProductSeries.Count(s => s.ProductId == item.ProductId) == 0)
                                {
                                    ProductSeries.Add(item);
                                }
                            }

                            if (items.Count() == 0 || items.Count() == ProductSeries.Count)
                            {
                                ItemTreshold = -1;
                                //return this.ProductSeries;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Crashes.TrackError(ex);
                        ItemTreshold = -1;
                    }
                }
            }, this.WhenAny(x => x.ProductSeries, x => x.GetValue().Count > 0));


            //选择商品
            this.WhenAnyValue(x => x.Selecter).Throttle(TimeSpan.FromMilliseconds(500))
            .Skip(1)
            .Where(x => x != null)
            .SubOnMainThread(async item =>
            {
                await this.NavigateAsync("AddProductArchivePage", ("Product", item));
                Selecter = null;
            }).DisposeWith(DeactivateWith);

            this.AddCommand = ReactiveCommand.Create <object>(async e => await this.NavigateAsync("AddProductArchivePage"));

            this.CatagorySelected = ReactiveCommand.Create <object>(async e =>
            {
                await SelectCatagory((data) =>
                {
                    Filter.CatagoryId   = data.Id;
                    Filter.CatagoryName = data.Name;
                    Filter.CatagoryIds  = new int[] { data.Id };
                });
            });

            this.BindBusyCommand(Load);


            this.Load.ThrownExceptions.Subscribe(ex => { Debug.Print(ex.StackTrace); }).DisposeWith(this.DeactivateWith);
            this.SerchCommand.ThrownExceptions.Subscribe(ex => { Debug.Print(ex.StackTrace); }).DisposeWith(this.DeactivateWith);
            this.ItemTresholdReachedCommand.ThrownExceptions.Subscribe(ex => { Debug.Print(ex.StackTrace); }).DisposeWith(this.DeactivateWith);
            this.AddCommand.ThrownExceptions.Subscribe(ex => { Debug.Print(ex.StackTrace); }).DisposeWith(this.DeactivateWith);
            this.CatagorySelected.ThrownExceptions.Subscribe(ex => { Debug.Print(ex.StackTrace); }).DisposeWith(this.DeactivateWith);
        }
 public MainViewModel(IDialogService dialogService,
                      IErrorHandler errorHandler) : base(dialogService, errorHandler)
 {
 }
Example #53
0
 public AssetDetailViewModel(INavService nav, IHttpService http, IDialogService dialog) : base(nav, http, dialog)
 {
 }
Example #54
0
        public InventoryEditorViewModel(BaseViewModel parentViewModel, InventoryEditorModel dataModel, IDialogService dialogService)
            : base(parentViewModel)
        {
            Contract.Requires(dialogService != null);

            _dialogService = dialogService;
            _dataModel     = dataModel;
            Selections     = new ObservableCollection <InventoryModel>();
            // Will bubble property change events from the Model to the ViewModel.
            _dataModel.PropertyChanged += (sender, e) => OnPropertyChanged(e.PropertyName);
        }
Example #55
0
        public LoginViewModel(IRegionManager regionManager, IUserService userService, IDialogService dialogService)
        {
            _regionManager = regionManager;
            _userService   = userService;
            _dialogService = dialogService;

            LoginCommand = new DelegateCommand(Login, CanLogin).ObservesProperty(() => Username);
        }
Example #56
0
 public MainViewModel()
 {
     // DialogService is used to handle dialogs
     this.DialogService = new MvvmDialogs.DialogService();
 }
        public PersonDetailsViewModel(IPersonService personService, IDispatcher dispatcher, IEventAggregator aggregator, IDialogService dialogService)
            : base(personService, dispatcher, aggregator, dialogService)
        {
            aggregator.GetEvent <SelectedPersonChangeEvent>().Subscribe(OnSelectedPersonChanged, ThreadOption.BackgroundThread);

            NewPersonCommand    = new DelegateCommand(NewPerson);
            EditPersonCommand   = new DelegateCommand(EditPerson, CanEditPerson);
            DeletePersonCommand = new DelegateCommand(DeletePerson, CanDeletePerson);
        }
Example #58
0
 public AnalysisService(SpanFactory <ShapeNode> spanFactory, SegmentPool segmentPool, IProjectService projectService, IDialogService dialogService, IBusyService busyService)
 {
     _spanFactory    = spanFactory;
     _segmentPool    = segmentPool;
     _projectService = projectService;
     _dialogService  = dialogService;
     _busyService    = busyService;
 }
Example #59
0
 public RegisterViewModel(IDialogService dialogService, IWebAPIService webAPIService, IMvxNavigationService navigationService)
 {
     _dialogService     = dialogService;
     _webAPIService     = webAPIService;
     _navigationService = navigationService;
 }
Example #60
0
        public MainViewModel(ICollection <IDetector> detectors, WoaDeployer deployer, IDialogService dialogService, IFilePicker filePicker, OperationProgressViewModel operationProgress)
        {
            OperationProgress = operationProgress;
            Detect            = ReactiveCommand.CreateFromTask(async() =>
            {
                var detections = await Task.WhenAll(detectors.Select(d => d.Detect()));
                return(detections.FirstOrDefault(d => d != null));
            });

            var hasDevice = this.WhenAnyValue(model => model.Device).Select(d => d != null);

            Detect.Subscribe(detected =>
            {
                Device = detected;
            }).DisposeWith(disposables);

            Detect.SelectMany(async d =>
            {
                if (d == null)
                {
                    await dialogService.Notice("Cannot autodetect any device",
                                               "Cannot detect any device. Please, select your device manually");
                }

                return(Unit.Default);
            })
            .Subscribe()
            .DisposeWith(disposables);

            GetRequirements = ReactiveCommand.CreateFromTask(() => deployer.GetRequirements(Device), hasDevice);
            requirements    = GetRequirements.ToProperty(this, model => model.Requirements);
            Deploy          = ReactiveCommand.CreateFromTask(async() =>
            {
                try
                {
                    await deployer.Deploy(Device);
                    messages.OnNext("Deployment finished!");
                }
                catch (DeploymentCancelledException)
                {
                    messages.OnNext("Deployment cancelled");
                    Log.Information("Deployment cancelled");
                }
                catch (Exception e)
                {
                    messages.OnNext("Deployment failed");
                    Log.Error(e, "Deployment failed");
                }
            }, hasDevice);

            RunScript = ReactiveCommand.CreateFromObservable(() =>
            {
                var filter = new FileTypeFilter("Deployer Script", new[] { "*.ds", "*.txt" });
                return(filePicker
                       .Open("Select a script", new[] { filter })
                       .Where(x => x != null)
                       .SelectMany(file => Observable.FromAsync(() => deployer.RunScript(file.Source.LocalPath))));
            });

            dialogService.HandleExceptionsFromCommand(RunScript);
            dialogService.HandleExceptionsFromCommand(Deploy);
            isDeploying = Deploy.IsExecuting.Merge(RunScript.IsExecuting).ToProperty(this, x => x.IsBusy);
        }