Exemple #1
0
 public ComponentControl()
 {
     this._busyService        = ViewContainer.Instance.Resolve <IBusyService>();
     this._undoService        = ViewContainer.Instance.Resolve <IUndoService>();
     this._valueEditorService = ViewContainer.Instance.Resolve <IValueEditorService>();
     this.InitializeComponent();
 }
Exemple #2
0
        public WeeklyOverviewViewmodel(ITimeEntryService timeEntryService, IBusyService busyService, ITimeEntryRepository timeEntryRepository,
                                       ITaskItemViewmodelFactory taskItemViewmodelFactory, ITimeEntryTypeRepository timeEntryTypeRepository,
                                       ISyncService syncService, ICommonDialogs commonDialogs)
        {
            _timeEntryService = timeEntryService;
            //_busyService = busyService;
            _timeEntryRepository      = timeEntryRepository;
            _taskItemViewmodelFactory = taskItemViewmodelFactory;
            _timeEntryTypeRepository  = timeEntryTypeRepository;
            _syncService                    = syncService;
            _commonDialogs                  = commonDialogs;
            _syncCompletedCommand           = new DelegateCommand <object>(SyncCompletedExecute);
            PreviousDateCommand             = new DelegateCommand <object>(a => StartDate = StartDate.AddDays(-7));
            NextDayCommand                  = new DelegateCommand <object>(a => StartDate = StartDate.AddDays(7));
            TodayCommand                    = new DelegateCommand <object>(a => TodayCommandExecute());
            SwitchToDayViewCommand          = new DelegateCommand <object>(SwitchToDayViewCommandExecute);
            CopyPreviousTasksToSelectedDate = new DelegateCommand <object>(CopyPreviousTasksToSelectedDateExecute);
            AddTaskCommand                  = new DelegateCommand <object>(AddTaskCommandExecute);
            SaveCommand     = new DelegateCommand <object>(SaveCommandExecute);
            DeleteTimeEntry = new DelegateCommand <object>(DeleteTimeEntryExecute);
            ApplicationCommands.SyncCompleted.RegisterCommand(_syncCompletedCommand);
            TaskCommands.TaskSelectCompleted.RegisterCommand(new DelegateCommand <Task>(TaskSelectCompleted));
            TaskCommands.SaveTaskCancelled.RegisterCommand(new DelegateCommand <TimeEntry>(TaskSelectCompleted));

            Rows                    = new ObservableItemCollection <TaskItemViewmodel>();
            Rows.ItemChanged       += TasksOnItemChanged;
            _deletedRows            = new List <TaskItemViewmodel>();
            _timeEntriesForThisWeek = new List <TimeEntry>();

            TimeEntryTypes = _timeEntryTypeRepository.GetGlobal();
            StartDate      = DateTime.Today.FirstDayOfWeek();
        }
        public ReportScreenMasterViewModel(ITimeEntryService timeEntryService, IBusyService busyService, IConnectivityService connectivityService,
                                           ITimeEntryTypeRepository timeEntryTypeRepository, ITimeEntryRepository timeEntryRepository, IAppSettings appSettings)
        {
            _timeEntryService        = timeEntryService;
            _busyService             = busyService;
            _connectivityService     = connectivityService;
            _timeEntryTypeRepository = timeEntryTypeRepository;
            _timeEntryRepository     = timeEntryRepository;
            _appSettings             = appSettings;
            Search = new DelegateCommand <object>(ExecuteSearch);
            _busyService.ShowBusy(_reportscreenKey);
            LoadPredefinedSearchItems();
            SelectedPredefinedSearch = PredefinedSearchItems[1];
            EditTimeEntryCommand     = new DelegateCommand <object>(EditTimeEntry);
            SaveCommand = new DelegateCommand <object>(SaveCommandExecute);

            try
            {
                TimeEntryTypes = _timeEntryTypeRepository.GetGlobal();
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            TaskCommands.SaveTaskCompleted.RegisterCommand(new DelegateCommand(Reload));
            TaskCommands.SaveTaskCancelled.RegisterCommand(new DelegateCommand(Reload));

            ApplicationCommands.ConnectivityChanged.RegisterCommand(new DelegateCommand <object>(ConnectivityChangedExecute));
        }
Exemple #4
0
 public ImportService(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IAnalysisService analysisService)
 {
     _projectService = projectService;
     _dialogService = dialogService;
     _busyService = busyService;
     _analysisService = analysisService;
 }
Exemple #5
0
 public AnalysisService(SegmentPool segmentPool, IProjectService projectService, IDialogService dialogService, IBusyService busyService)
 {
     _segmentPool    = segmentPool;
     _projectService = projectService;
     _dialogService  = dialogService;
     _busyService    = busyService;
 }
        public OptionGroupViewModel(IBusyService busyService, IUnityContainer container, IMessageBoxService messageBoxService, IDesktopKeyEventHandler keyEventHandler, EventAggregator eventAggregator, OptionGroup <T> optionGroup, Character owner)
            : base(busyService, container)
        {
            this.eventAggregator        = eventAggregator;
            this.messageBoxService      = messageBoxService;
            this.desktopKeyEventHandler = keyEventHandler;
            this.Owner = owner;
            this.Owner.PropertyChanged += Owner_PropertyChanged;
            this.OptionGroup            = optionGroup;
            this.eventAggregator.GetEvent <AttackInitiatedEvent>().Subscribe(this.AttackInitiated);
            this.eventAggregator.GetEvent <AttackExecutionsFinishedEvent>().Subscribe(this.OnAttackExecutionFinished);
            this.eventAggregator.GetEvent <CombatMovementChangedEvent>().Subscribe((CharacterMovement cm) => {
                OnPropertyChanged("IsNonCombatMovementSelected");
                OnPropertyChanged("IsCombatMovementSelected");
            });
            if (!this.IsStandardOptionGroup)
            {
                this.eventAggregator.GetEvent <RemoveOptionEvent>().Subscribe(this.RemoveOption);
            }

            clickTimer_AbilityPlay.AutoReset = false;
            clickTimer_AbilityPlay.Interval  = 2000;
            clickTimer_AbilityPlay.Elapsed  +=
                new ElapsedEventHandler(clickTimer_AbilityPlay_Elapsed);

            InitializeCommands();
            SetTooltips();
            this.InitializeDesktopKeyEventHandlers();
        }
Exemple #7
0
 public ImportService(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IAnalysisService analysisService)
 {
     _projectService  = projectService;
     _dialogService   = dialogService;
     _busyService     = busyService;
     _analysisService = analysisService;
 }
Exemple #8
0
 public AttackTargetSelectionViewModel(IBusyService busyService, IUnityContainer container, EventAggregator eventAggregator)
     : base(busyService, container)
 {
     this.eventAggregator = eventAggregator;
     this.eventAggregator.GetEvent <AttackTargetsSelectionRequiredEvent>().Subscribe(this.LoadAttackTargets);
     this.ConfirmAttackTargetsCommand = new DelegateCommand(ConfirmAttackTargets);
 }
Exemple #9
0
 public SettingsPartViewModel(IMyDialogService dlg, IBusyService busy, IAppSettingsService _appSettings, IStorageInterfaceService _storageInterfaceService)
 {
     this.DialogSrv        = dlg;
     this.BusySrv          = busy;
     this._settings        = _appSettings;
     this.StorageInterface = _storageInterfaceService;
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommonServices" /> class.
 /// </summary>
 /// <param name="busyService">The busy indicator service.</param>
 /// <param name="messageService">The messaging service</param>
 /// <param name="languageService">The language service.</param>
 /// <param name="telemetryService">The telemetry service.</param>
 /// <param name="dialogService">The dialog service.</param>
 /// <param name="navigationService">The navigation service.</param>
 /// <param name="fileService">The file service.</param>
 /// <param name="infoService">The information service.</param>
 /// <param name="converterService">The converter service.</param>
 /// <param name="dispatcherService">The dispatcher service.</param>
 /// <param name="authenticationService">The authentication service.</param>
 public CommonServices(
     IBusyService busyService,
     IMessageService messageService,
     ILanguageService languageService,
     ITelemetryService telemetryService,
     IDialogService dialogService,
     INavigationService navigationService,
     IFileService fileService,
     IInfoService infoService,
     IConverterService converterService,
     IDispatcherService dispatcherService,
     IAuthenticationService authenticationService)
     : base(busyService,
            messageService,
            languageService,
            telemetryService,
            dialogService,
            navigationService,
            infoService,
            converterService,
            dispatcherService)
 {
     AuthenticationService = authenticationService;
     FileService           = fileService;
 }
Exemple #11
0
 public AutoFireAttackConfigurationViewModel(IBusyService busyService, IUnityContainer container, EventAggregator eventAggregator)
     : base(busyService, container)
 {
     this.eventAggregator = eventAggregator;
     this.eventAggregator.GetEvent <AssignAutoFireAttackShotsEvent>().Subscribe(this.LoadAttackTargets);
     this.ConfirmAutoFireAttackCommand   = new DelegateCommand(ConfirmAutoFireAttack);
     this.DistributeNumberOfShotsCommand = new DelegateCommand <object>(this.DistributeNumberOfShots, CanDistributeNumberOfShots);
 }
Exemple #12
0
 public AnalysisService(SpanFactory <ShapeNode> spanFactory, SegmentPool segmentPool, IProjectService projectService, IDialogService dialogService, IBusyService busyService)
 {
     _spanFactory    = spanFactory;
     _segmentPool    = segmentPool;
     _projectService = projectService;
     _dialogService  = dialogService;
     _busyService    = busyService;
 }
Exemple #13
0
 public StartupViewModel(IBusyService busyService, IProjectService projectService, ISceneService sceneService)
 {
     this._busyService       = busyService;
     this.ProjectService     = projectService;
     this._sceneService      = sceneService;
     this.NewProjectCommand  = new RelayCommand(async() => await this.NewProject(), () => !this._busyService.IsBusy);
     this.OpenProjectCommand = new RelayCommand(async() => await this.OpenProject(), () => !this._busyService.IsBusy);
 }
Exemple #14
0
 public ImportService(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IAnalysisService analysisService)
 {
     _projectService             = projectService;
     _dialogService              = dialogService;
     _busyService                = busyService;
     _analysisService            = analysisService;
     _importerSettingsViewModels = new Dictionary <IImporter, object>();
 }
Exemple #15
0
 public AnalysisService(SpanFactory<ShapeNode> spanFactory, SegmentPool segmentPool, IProjectService projectService, IDialogService dialogService, IBusyService busyService)
 {
     _spanFactory = spanFactory;
     _segmentPool = segmentPool;
     _projectService = projectService;
     _dialogService = dialogService;
     _busyService = busyService;
 }
        void win_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
        {
            IBusyService busyService = container.Resolve <IBusyService>();

            if (busyService.IsShowingBusy)
            {
                e.Handled = true;
            }
        }
 public AttackConfigurationViewModel(IBusyService busyService, IUnityContainer container, IDesktopKeyEventHandler keyEventHandler, EventAggregator eventAggregator) : base(busyService, container)
 {
     this.eventAggregator        = eventAggregator;
     this.desktopKeyEventHandler = keyEventHandler;
     this.eventAggregator.GetEvent <ConfigureAttacksEvent>().Subscribe(this.ConfigureAttacks);
     this.eventAggregator.GetEvent <ConfirmAttacksEvent>().Subscribe(this.ConfirmAttacks);
     InitializeCommands();
     InitializeDesktopKeyEventHandlers();
 }
Exemple #18
0
 public ViewModelBase(
     IEventAggregator eventAggregator,
     IBusyService busyService,
     IUnityContainer container)
 {
     this.EventAggregator = eventAggregator;
     this.BusyService     = busyService;
     this.Container       = container;
     //this.EventsToLoad = 0; // default
 }
Exemple #19
0
 public WordPairsViewModel(IBusyService busyService)
 {
     _busyService = busyService;
     _wordPairs   = new BindableList <WordPairViewModel>();
     _wordPairs.CollectionChanged         += _wordPairs_CollectionChanged;
     _selectedWordPairs                    = new BindableList <WordPairViewModel>();
     _selectedWordPairs.CollectionChanged += _selectedWordPairs_CollectionChanged;
     _selectedCorrespondenceWordPairs      = new BindableList <WordPairViewModel>();
     _selectedWordPairsMonitor             = new SimpleMonitor();
 }
Exemple #20
0
 public WordPairsViewModel(IBusyService busyService)
 {
     _busyService = busyService;
     _wordPairs = new BindableList<WordPairViewModel>();
     _wordPairs.CollectionChanged += _wordPairs_CollectionChanged;
     _selectedWordPairs = new BindableList<WordPairViewModel>();
     _selectedWordPairs.CollectionChanged += _selectedWordPairs_CollectionChanged;
     _selectedCorrespondenceWordPairs = new BindableList<WordPairViewModel>();
     _selectedWordPairsMonitor = new SimpleMonitor();
 }
        public ActiveCharacterWidgetViewModel(IBusyService busyService, IUnityContainer container, EventAggregator eventAggregator)
            : base(busyService, container)
        {
            this.eventAggregator = eventAggregator;
            this.eventAggregator.GetEvent <ActivateCharacterEvent>().Subscribe(this.LoadCharacter);
            this.eventAggregator.GetEvent <ActivateGangEvent>().Subscribe(this.LoadGang);

            this.ActivatePanelCommand   = new DelegateCommand <string>(this.ActivatePanel);
            this.DeactivatePanelCommand = new DelegateCommand <string>(this.DeactivatePanel);
        }
Exemple #22
0
 public WordsViewModel(IBusyService busyService, ReadOnlyBindableList<WordViewModel> words)
 {
     _busyService = busyService;
     _words = words;
     _words.CollectionChanged += WordsChanged;
     _selectedWords = new BindableList<WordViewModel>();
     _selectedWords.CollectionChanged += _selectedWords_CollectionChanged;
     _selectedSegmentWords = new BindableList<WordViewModel>();
     _selectedWordsMonitor = new SimpleMonitor();
 }
Exemple #23
0
		public WordsViewModel(IBusyService busyService, ReadOnlyBindableList<WordViewModel> words)
		{
			_busyService = busyService;
			_words = words;
			_words.CollectionChanged += WordsChanged;
			_selectedWords = new BindableList<WordViewModel>();
			_selectedWords.CollectionChanged += _selectedWords_CollectionChanged;
			_selectedSegmentWords = new BindableList<WordViewModel>();
			_selectedWordsMonitor = new SimpleMonitor();
		}
        public MainPageViewModel(IMyDialogService dlg, IBusyService busy)
        {
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
            {
                Value = "Designtime value";
            }

            this.DialogSrv = dlg;
            this.BusySrv   = busy;
        }
Exemple #25
0
 public ActiveAttackViewModel(IBusyService busyService, IUnityContainer container, IMessageBoxService messageBoxService, IDesktopKeyEventHandler keyEventHandler, EventAggregator eventAggregator)
     : base(busyService, container)
 {
     this.eventAggregator        = eventAggregator;
     this.messageBoxService      = messageBoxService;
     this.desktopKeyEventHandler = keyEventHandler;
     InitializeCommands();
     //this.eventAggregator.GetEvent<ConfigureActiveAttackEvent>().Subscribe(this.ConfigureActiveAttack);
     //this.eventAggregator.GetEvent<ConfirmAttackEvent>().Subscribe(this.SetActiveAttack);
     InitializeDesktopKeyEventHandlers();
 }
 public CharacterEditorViewModel(IBusyService busyService, IUnityContainer container, IDesktopKeyEventHandler keyEventHandler, EventAggregator eventAggregator)
     : base(busyService, container)
 {
     this.eventAggregator        = eventAggregator;
     this.desktopKeyEventHandler = keyEventHandler;
     InitializeCommands();
     this.eventAggregator.GetEvent <EditCharacterEvent>().Subscribe(this.LoadCharacter);
     this.eventAggregator.GetEvent <DeleteCrowdMemberEvent>().Subscribe(this.UnLoadCharacter);
     this.eventAggregator.GetEvent <AttackInitiatedEvent>().Subscribe(this.AttackInitiated);
     this.eventAggregator.GetEvent <AttackExecutionsFinishedEvent>().Subscribe(this.AttackEnded);
 }
Exemple #27
0
 public void SetUp()
 {
     _busyService = Substitute.For<IBusyService>();
     _analysisService = Substitute.For<IAnalysisService>();
     _words = new ObservableList<WordViewModel>
     {
         new WordViewModel(_busyService, _analysisService, new Word("valid", _meaning)) {IsValid = true},
         new WordViewModel(_busyService, _analysisService, new Word("invalid", _meaning)) {IsValid = false}
     };
     _wordsViewModel = new WordsViewModel(_busyService, new ReadOnlyBindableList<WordViewModel>(_words));
     _meaning = new Meaning("gloss", "category");
 }
Exemple #28
0
        public ProjectService(SegmentPool segmentPool, IDialogService dialogService, IBusyService busyService,
                              ISettingsService settingsService, Lazy <IAnalysisService> analysisService)
        {
            _segmentPool     = segmentPool;
            _dialogService   = dialogService;
            _busyService     = busyService;
            _settingsService = settingsService;
            _analysisService = analysisService;

            Messenger.Default.Register <DomainModelChangedMessage>(this, HandleDomainModelChanged);
            Messenger.Default.Register <ComparisonPerformedMessage>(this, HandleComparisonPerformed);
        }
Exemple #29
0
        public VarietyPairsViewModel(IProjectService projectService, IBusyService busyService, IDialogService dialogService, IExportService exportService, IAnalysisService analysisService,
                                     VarietyPairViewModel.Factory varietyPairFactory)
            : base("Variety Pairs")
        {
            _projectService     = projectService;
            _busyService        = busyService;
            _dialogService      = dialogService;
            _exportService      = exportService;
            _analysisService    = analysisService;
            _varietyPairFactory = varietyPairFactory;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            _sortPropertyName = "PhoneticSimilarityScore";
            _sortDirection    = ListSortDirection.Descending;

            Messenger.Default.Register <PerformingComparisonMessage>(this, msg =>
            {
                if (msg.VarietyPair == null)
                {
                    ClearComparison();
                }
            });
            Messenger.Default.Register <ComparisonPerformedMessage>(this, msg =>
            {
                if (msg.VarietyPair == null)
                {
                    SetSelectedVarietyPair();
                }
            });
            Messenger.Default.Register <DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                {
                    ClearComparison();
                }
            });
            Messenger.Default.Register <SwitchViewMessage>(this, HandleSwitchView);

            _findCommand = new RelayCommand(Find);
            _performComparisonCommand = new RelayCommand(PerformComparison);

            _selectedWordPairsMonitor = new SimpleMonitor();
            _varietyPairState         = VarietyPairState.NotSelected;
            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                                                     new TaskAreaCommandViewModel("Compare variety pair", new RelayCommand(PerformComparison, CanPerformComparison)),
                                                     new TaskAreaCommandViewModel("Find words", _findCommand),
                                                     new TaskAreaItemsViewModel("Sort word pairs by", new TaskAreaCommandGroupViewModel(
                                                                                    new TaskAreaCommandViewModel("Similarity", new RelayCommand(() => SortWordPairsBy("PhoneticSimilarityScore", ListSortDirection.Descending))),
                                                                                    new TaskAreaCommandViewModel("Gloss", new RelayCommand(() => SortWordPairsBy("Meaning.Gloss", ListSortDirection.Ascending)))))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                                                     new TaskAreaCommandViewModel("Export results for variety pair", new RelayCommand(ExportVarietyPair, CanExportVarietyPair))));
        }
Exemple #30
0
 public WordViewModel(IBusyService busyService, IAnalysisService analysisService, Word word)
 {
     _busyService = busyService;
     _analysisService = analysisService;
     _meaning = new MeaningViewModel(word.Meaning);
     _word = word;
     LoadSegments();
     _monitor = new SimpleMonitor();
     _showInWordListsCommand = new RelayCommand(ShowInWordLists);
     _showInVarietiesCommand = new RelayCommand(ShowInVarieties);
     _word.PropertyChanged += WordPropertyChanged;
 }
Exemple #31
0
 public WordViewModel(IBusyService busyService, IAnalysisService analysisService, Word word)
 {
     _busyService     = busyService;
     _analysisService = analysisService;
     _meaning         = new MeaningViewModel(word.Meaning);
     _word            = word;
     LoadSegments();
     _monitor = new SimpleMonitor();
     _showInWordListsCommand = new RelayCommand(ShowInWordLists);
     _showInVarietiesCommand = new RelayCommand(ShowInVarieties);
     _word.PropertyChanged  += WordPropertyChanged;
 }
Exemple #32
0
        #pragma warning restore 67

        public MainViewModel(IMyDialogService dlg, IBusyService busy, IAppSettingsService settings)
        {
            this.DialogSrv   = dlg;
            this.BusySrv     = busy;
            this.settingsSrv = settings;

            AvailableTransportTypes = EnumHelper.ListOf <TransportType>();
            AvailableDevices        = new ObservableCollection <NanoDeviceBase>();

            SelectedDevice = null;
            SelectedDeviceConnectionResult = PingConnectionResult.None;
            IsBusyHeader = false;
        }
Exemple #33
0
        public void ProjectOpened_ComponentChanged_WorkspaceReset()
        {
            IProjectService projectService = Substitute.For <IProjectService>();
            IBusyService    busyService    = Substitute.For <IBusyService>();
            var             workspace      = new TestSettingsWorkspaceViewModel(projectService, busyService);

            workspace.TestComponent.ForceChanged();
            Assert.That(workspace.IsDirty, Is.True);
            projectService.ProjectOpened += Raise.Event();
            Assert.That(workspace.IsDirty, Is.False);
            Assert.That(workspace.TestComponent.IsUpdated, Is.False);
            Assert.That(workspace.TestComponent.IsChanged, Is.False);
        }
        public BaseViewModel(IBusyService busyService, IUnityContainer container)
        {
            this.BusyService = busyService;
            this.Container   = container;

            // save the dispatcher so that UI can be updated from another thread
            this.Dispatcher = Dispatcher.CurrentDispatcher;

            this.UIAction =
                ((uiAction) =>
                 this.Dispatcher.BeginInvoke(uiAction)
                );
        }
Exemple #35
0
        public void Apply_ComponentChanged_IsChangedSetToFalse()
        {
            IProjectService projectService = Substitute.For <IProjectService>();
            IBusyService    busyService    = Substitute.For <IBusyService>();
            var             workspace      = new TestSettingsWorkspaceViewModel(projectService, busyService);

            workspace.TestComponent.ForceChanged();
            Assert.That(workspace.IsDirty, Is.True);
            workspace.Apply();
            Assert.That(workspace.IsDirty, Is.False);
            Assert.That(workspace.TestComponent.IsUpdated, Is.True);
            Assert.That(workspace.TestComponent.IsChanged, Is.False);
        }
Exemple #36
0
        public ProjectService(SpanFactory<ShapeNode> spanFactory, SegmentPool segmentPool, IDialogService dialogService, IBusyService busyService,
			ISettingsService settingsService, Lazy<IAnalysisService> analysisService)
        {
            _spanFactory = spanFactory;
            _segmentPool = segmentPool;
            _dialogService = dialogService;
            _busyService = busyService;
            _settingsService = settingsService;
            _analysisService = analysisService;

            Messenger.Default.Register<DomainModelChangedMessage>(this, HandleDomainModelChanged);
            Messenger.Default.Register<ComparisonPerformedMessage>(this, HandleComparisonPerformed);
        }
Exemple #37
0
        public WordListsVarietyMeaningViewModel(IBusyService busyService, IAnalysisService analysisService, WordViewModel.Factory wordFactory, WordListsVarietyViewModel variety, Meaning meaning)
            : base(meaning)
        {
            _busyService     = busyService;
            _analysisService = analysisService;
            _variety         = variety;

            _domainWords = new ObservableList <Word>(variety.DomainVariety.Words[meaning]);
            _words       = new MirroredBindableList <Word, WordViewModel>(_domainWords, word => wordFactory(word), vm => vm.DomainWord);
            _domainWords.CollectionChanged += DomainWordsChanged;
            _strRep = string.Join(",", _domainWords.Select(word => word.StrRep));
            _showInVarietiesCommand = new RelayCommand(ShowInVarieties, () => _domainWords.Count > 0);
        }
        public WordListsVarietyMeaningViewModel(IBusyService busyService, IAnalysisService analysisService, WordViewModel.Factory wordFactory, WordListsVarietyViewModel variety, Meaning meaning)
            : base(meaning)
        {
            _busyService = busyService;
            _analysisService = analysisService;
            _variety = variety;

            _domainWords = new ObservableList<Word>(variety.DomainVariety.Words[meaning]);
            _words = new MirroredBindableList<Word, WordViewModel>(_domainWords, word => wordFactory(word), vm => vm.DomainWord);
            _domainWords.CollectionChanged += DomainWordsChanged;
            _strRep = string.Join(",", _domainWords.Select(word => word.StrRep));
            _showInVarietiesCommand = new RelayCommand(ShowInVarieties, () => _domainWords.Count > 0);
        }
        protected SettingsWorkspaceViewModelBase(string title, IProjectService projectService, IBusyService busyService, params ComponentSettingsViewModelBase[] components)
            : base("Settings")
        {
            _title = title;
            _projectService = projectService;
            _busyService = busyService;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            _components = new ReadOnlyList<ComponentSettingsViewModelBase>(components);
            foreach (ComponentSettingsViewModelBase componentVM in _components)
                componentVM.PropertyChanged += Component_PropertyChanged;
            _applyCommand = new RelayCommand(Apply, CanApply);
            _resetCommand = new RelayCommand(Reset);
        }
Exemple #40
0
        public VarietyPairsViewModel(IProjectService projectService, IBusyService busyService, IDialogService dialogService, IExportService exportService, IAnalysisService analysisService,
			VarietyPairViewModel.Factory varietyPairFactory)
            : base("Variety Pairs")
        {
            _projectService = projectService;
            _busyService = busyService;
            _dialogService = dialogService;
            _exportService = exportService;
            _analysisService = analysisService;
            _varietyPairFactory = varietyPairFactory;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            _sortPropertyName = "PhoneticSimilarityScore";
            _sortDirection = ListSortDirection.Descending;

            Messenger.Default.Register<PerformingComparisonMessage>(this, msg =>
            {
                if (msg.VarietyPair == null)
                    ClearComparison();
            });
            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg =>
            {
                if (msg.VarietyPair == null)
                    SetSelectedVarietyPair();
            });
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                    ClearComparison();
            });
            Messenger.Default.Register<SwitchViewMessage>(this, HandleSwitchView);

            _findCommand = new RelayCommand(Find);
            _performComparisonCommand = new RelayCommand(PerformComparison);

            _selectedWordPairsMonitor = new SimpleMonitor();
            _varietyPairState = VarietyPairState.NotSelected;
            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                new TaskAreaCommandViewModel("Compare variety pair", new RelayCommand(PerformComparison, CanPerformComparison)),
                new TaskAreaCommandViewModel("Find words", _findCommand),
                new TaskAreaItemsViewModel("Sort word pairs by", new TaskAreaCommandGroupViewModel(
                    new TaskAreaCommandViewModel("Similarity", new RelayCommand(() => SortWordPairsBy("PhoneticSimilarityScore", ListSortDirection.Descending))),
                    new TaskAreaCommandViewModel("Gloss", new RelayCommand(() => SortWordPairsBy("Meaning.Gloss", ListSortDirection.Ascending)))))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Export results for variety pair", new RelayCommand(ExportVarietyPair, CanExportVarietyPair))));
        }
        public GlobalCorrespondencesViewModel(IProjectService projectService, IBusyService busyService, IDialogService dialogService, IImageExportService imageExportService, IGraphService graphService,
			WordPairsViewModel.Factory wordPairsFactory, WordPairViewModel.Factory wordPairFactory)
            : base("Global Correspondences")
        {
            _projectService = projectService;
            _busyService = busyService;
            _dialogService = dialogService;
            _imageExportService = imageExportService;
            _graphService = graphService;
            _wordPairFactory = wordPairFactory;

            _selectedVarieties = new HashSet<Variety>();

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg => GenerateGraph());
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                    ClearGraph();
            });
            Messenger.Default.Register<PerformingComparisonMessage>(this, msg => ClearGraph());

            _findCommand = new RelayCommand(Find);

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Syllable position",
                new TaskAreaCommandViewModel("Onset", new RelayCommand(() => SyllablePosition = SyllablePosition.Onset)),
                new TaskAreaCommandViewModel("Nucleus", new RelayCommand(() => SyllablePosition = SyllablePosition.Nucleus)),
                new TaskAreaCommandViewModel("Coda", new RelayCommand(() => SyllablePosition = SyllablePosition.Coda))));
            _correspondenceFilter = new TaskAreaIntegerViewModel("Frequency threshold");
            _correspondenceFilter.PropertyChanging += _correspondenceFilter_PropertyChanging;
            _correspondenceFilter.PropertyChanged += _correspondenceFilter_PropertyChanged;
            TaskAreas.Add(_correspondenceFilter);
            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                new TaskAreaCommandViewModel("Find words", _findCommand),
                new TaskAreaItemsViewModel("Sort word pairs by", new TaskAreaCommandGroupViewModel(
                    new TaskAreaCommandViewModel("Gloss", new RelayCommand(() => _observedWordPairs.UpdateSort("Meaning.Gloss", ListSortDirection.Ascending))),
                    new TaskAreaCommandViewModel("Similarity", new RelayCommand(() => _observedWordPairs.UpdateSort("PhoneticSimilarityScore", ListSortDirection.Descending))))),
                new TaskAreaCommandViewModel("Select varieties", new RelayCommand(SelectVarieties))
                ));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Export chart", new RelayCommand(ExportChart, CanExportChart))));
            _observedWordPairs = wordPairsFactory();
            _observedWordPairs.IncludeVarietyNamesInSelectedText = true;
            _observedWordPairs.UpdateSort("Meaning.Gloss", ListSortDirection.Ascending);
        }
Exemple #42
0
        public MeaningsViewModel(IProjectService projectService, IDialogService dialogService, IBusyService busyService)
            : base("Meanings")
        {
            _projectService = projectService;
            _dialogService = dialogService;
            _busyService = busyService;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                new TaskAreaCommandViewModel("Add a new meaning", new RelayCommand(AddNewMeaning)),
                new TaskAreaCommandViewModel("Edit meaning", new RelayCommand(EditSelectedMeaning, CanEditSelectedMeaning)),
                new TaskAreaCommandViewModel("Remove meaning", new RelayCommand(RemoveSelectedMeaning, CanRemoveSelectedMeaning))));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Move meaning up", new RelayCommand(MoveSelectedMeaningUp, CanMoveSelectedMeaningUp)),
                new TaskAreaCommandViewModel("Move meaning down", new RelayCommand(MoveSelectedMeaningDown, CanMoveSelectedMeaningDown))));
        }
        protected SettingsWorkspaceViewModelBase(string title, IProjectService projectService, IBusyService busyService, params ComponentSettingsViewModelBase[] components)
            : base("Settings")
        {
            _title = title;
            _busyService = busyService;

            _applyCommand = new RelayCommand(Apply, CanApply);
            _resetCommand = new RelayCommand(Reset);

            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                new TaskAreaCommandViewModel("Apply changes", _applyCommand),
                new TaskAreaCommandViewModel("Reset changes", _resetCommand)));

            projectService.ProjectOpened += projectService_ProjectOpened;

            _components = new ReadOnlyList<ComponentSettingsViewModelBase>(components);
            foreach (ComponentSettingsViewModelBase componentVM in _components)
                componentVM.PropertyChanged += Component_PropertyChanged;
        }
Exemple #44
0
        public SegmentsViewModel(IProjectService projectService, IDialogService dialogService, IBusyService busyService, IExportService exportService, WordsViewModel.Factory wordsFactory,
			WordViewModel.Factory wordFactory)
            : base("Segments")
        {
            _projectService = projectService;
            _busyService = busyService;
            _dialogService = dialogService;
            _exportService = exportService;
            _wordFactory = wordFactory;

            _findCommand = new RelayCommand(Find);

            TaskAreas.Add(new TaskAreaCommandGroupViewModel("Syllable position",
                new TaskAreaCommandViewModel("Onset", new RelayCommand(() => SyllablePosition = SyllablePosition.Onset)),
                new TaskAreaCommandViewModel("Nucleus", new RelayCommand(() => SyllablePosition = SyllablePosition.Nucleus)),
                new TaskAreaCommandViewModel("Coda", new RelayCommand(() => SyllablePosition = SyllablePosition.Coda))));

            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                new TaskAreaCommandViewModel("Find words", _findCommand),
                new TaskAreaItemsViewModel("Sort words by", new TaskAreaCommandGroupViewModel(
                    new TaskAreaCommandViewModel("Meaning", new RelayCommand(() => SortWordsBy("Meaning.Gloss", ListSortDirection.Ascending))),
                    new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortWordsBy("StrRep", ListSortDirection.Ascending)))))));

            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Export segment frequencies", new RelayCommand(ExportSegmentFrequencies, CanExportSegmentFrequencies))));

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
                {
                    if (msg.AffectsComparison)
                        PopulateSegments();
                });

            _currentWords = new BulkObservableList<WordViewModel>();
            _observedWords = wordsFactory(new ReadOnlyBindableList<WordViewModel>(_currentWords));
            _domainSegments = new BulkObservableList<Segment>();
            _segments = new BulkObservableList<SegmentViewModel>();
            _readonlySegments = new ReadOnlyBindableList<SegmentViewModel>(_segments);
            _categories = new BulkObservableList<SegmentCategoryViewModel>();
            _readonlyCategories = new ReadOnlyBindableList<SegmentCategoryViewModel>(_categories);
        }
        public MultipleWordAlignmentViewModel(IProjectService projectService, IBusyService busyService, IExportService exportService, IAnalysisService analysisService)
            : base("Multiple Word Alignment")
        {
            _projectService = projectService;
            _busyService = busyService;
            _exportService = exportService;
            _analysisService = analysisService;

            _projectService.ProjectOpened += _projectService_ProjectOpened;

            var showCognateSets = new TaskAreaBooleanViewModel("Show cognate sets") {Value = true};
            showCognateSets.PropertyChanged += _showCognateSets_PropertyChanged;
            TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks",
                new TaskAreaItemsViewModel("Sort words by",
                    new TaskAreaCommandGroupViewModel(
                        new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortBy("StrRep", ListSortDirection.Ascending))),
                        new TaskAreaCommandViewModel("Variety", new RelayCommand(() => SortBy("Variety", ListSortDirection.Ascending)))),
                    showCognateSets)));
            TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks",
                new TaskAreaCommandViewModel("Export all cognate sets", new RelayCommand(ExportCognateSets, CanExportCognateSets))));

            _words = new BindableList<MultipleWordAlignmentWordViewModel>();
            _selectedWords = new BindableList<MultipleWordAlignmentWordViewModel>();

            _showInVarietyPairsCommand = new RelayCommand(ShowInVarietyPairs, CanShowInVarietyPairs);
            _performComparisonCommand = new RelayCommand(PerformComparison);

            _groupByCognateSet = true;
            _sortByProp = "StrRep";

            Messenger.Default.Register<ComparisonPerformedMessage>(this, msg => AlignWords());
            Messenger.Default.Register<DomainModelChangedMessage>(this, msg =>
            {
                if (msg.AffectsComparison)
                    ResetAlignment();
            });
            Messenger.Default.Register<PerformingComparisonMessage>(this, msg => ResetAlignment());
            Messenger.Default.Register<SwitchViewMessage>(this, HandleSwitchView);
        }
Exemple #46
0
 public ExportService(IProjectService projectService, IDialogService dialogService, IBusyService busyService)
 {
     _projectService = projectService;
     _dialogService = dialogService;
     _busyService = busyService;
 }
Exemple #47
0
 public CommandAgent(IBusyService busyService)
 {
     this.busyService = busyService;
 }
 public TestSettingsWorkspaceViewModel(IProjectService projectService, IBusyService busyService)
     : base("Test Workspace", projectService, busyService, new TestComponentSettingsViewModel())
 {
 }
Exemple #49
0
        public CompareSettingsViewModel(IProjectService projectService, IBusyService busyService, AlineViewModel alineViewModel,
			CognateIdentifierOptionsViewModel cognateIdentifierOptionsViewModel)
            : base("Comparison", projectService, busyService, alineViewModel, cognateIdentifierOptionsViewModel)
        {
        }
Exemple #50
0
        public InputSettingsViewModel(IProjectService projectService, IBusyService busyService, SyllabifierViewModel syllabifierViewModel,
			PoorMansAffixIdentifierViewModel affixIdentifierViewModel)
            : base("Input", projectService, busyService, syllabifierViewModel, affixIdentifierViewModel)
        {
        }