public BaseViewModel(IMvxMessenger messenger) : base()
        {
            _messenger = messenger;

            _token = _messenger.Subscribe<ReloadDataMessage>(async _ => 
				await ReloadDataAsync());
        }
 public FolderControllerViewModel(IFolderObserver observer, IMvxMessenger hub)
 {
     this.observer = observer;
     this.hub = hub;
     this.files = new Dictionary<string, DateTime>(64);
     this.mvxSubscriptionToken = hub.Subscribe<NewFileMessage>(this.NewFileReceived);
 }
Beispiel #3
0
        public DataViewModel(IMvxMessenger hub, IDataStorage<DataSample> data)
        {
            this.hub = hub;
            this.data = data;

            this.mvxSubscriptionToken = hub.Subscribe<NewDataMessage>(a => this.RaisePropertyChanged(() => this.DataList));
        }
 public HomeViewModel(IDescriptionService descriptionService, IMvxMessenger messenger)
 {
     _token = messenger.SubscribeOnMainThread<TickMessage>(OnTick);
     Descriptions = descriptionService.Descriptions
                                     .Select(x => new DescriptionViewModel(x))
                                     .ToList();
 }
 public GenerateViewModel(IMvxMessenger messenger, IDisplayDimensionsService displayDimensionsService,
                          IMandelbrotTaskGenerator mandelbrotTaskGenerator)
 {
     _displayDimensionsService = displayDimensionsService;
     _mandelbrotTaskGenerator = mandelbrotTaskGenerator;
     _mvxSubscriptionToken = messenger.SubscribeOnMainThread<TickMessage>(OnTick);
     _autoPlay = true;
 }
        /// <summary>
        ///     Creates a StatisticViewModel Object.
        /// </summary>
        protected StatisticViewModel()
        {
            StartDate = DateTime.Today.GetFirstDayOfMonth();
            EndDate = DateTime.Today.GetLastDayOfMonth();

            token = MessageHub.Subscribe<DateSelectedMessage>(message =>
            {
                StartDate = message.StartDate;
                EndDate = message.EndDate;
            });
        }
Beispiel #7
0
 public SourceViewModel()
 {
     _editToken = Messenger.SubscribeOnMainThread<SourceEditMessage>(x =>
     {
         if (x.OldSha == null || x.Update == null)
             return;
         _gitUrl = x.Update.Content.GitUrl;
         if (LoadCommand.CanExecute(null))
             LoadCommand.Execute(true);
     });
 }
        /// <summary>
        ///     Creates a Statistic ViewModel with custom start and end date
        /// </summary>
        /// <param name="startDate">Start date to select data from.</param>
        /// <param name="endDate">End date to select date from.</param>
        protected StatisticViewModel(DateTime startDate, DateTime endDate)
        {
            StartDate = startDate;
            EndDate = endDate;

            token = MessageHub.Subscribe<DateSelectedMessage>(message =>
            {
                StartDate = message.StartDate;
                EndDate = message.EndDate;
                Load();
            });
        }
        /// <summary>
        ///     Creates a Statistic ViewModel with custom start and end date
        /// </summary>
        /// <param name="startDate">Start date to select data from.</param>
        /// <param name="endDate">End date to select date from.</param>
        protected StatisticViewModel(DateTime startDate, DateTime endDate, IMvxMessenger messenger)
        {
            StartDate = startDate;
            EndDate = endDate;
            this.messenger = messenger;

            token = messenger.Subscribe<DateSelectedMessage>(message =>
            {
                StartDate = message.StartDate;
                EndDate = message.EndDate;
                Load();
            });
        }
        public ModifyPaymentViewModel(IPaymentRepository paymentRepository,
            IAccountRepository accountRepository,
            IDialogService dialogService,
            IPaymentManager paymentManager,
            IDefaultManager defaultManager)
        {
            this.paymentRepository = paymentRepository;
            this.dialogService = dialogService;
            this.paymentManager = paymentManager;
            this.defaultManager = defaultManager;
            this.accountRepository = accountRepository;

            token = MessageHub.Subscribe<CategorySelectedMessage>(ReceiveMessage);
        }
        public ModifyTransactionViewModel(ITransactionRepository transactionRepository,
            IAccountRepository accountRepository,
            IDialogService dialogService,
            ITransactionManager transactionManager,
            IDefaultManager defaultManager)
        {
            this.transactionRepository = transactionRepository;
            this.dialogService = dialogService;
            this.transactionManager = transactionManager;
            this.defaultManager = defaultManager;
            this.accountRepository = accountRepository;

            token = MessageHub.Subscribe<CategorySelectedMessage>(message => SelectedTransaction.Category = message.SelectedCategory);
        }
        public ModifyPaymentViewModel(IPaymentRepository paymentRepository,
            IAccountRepository accountRepository,
            IDialogService dialogService,
            IPaymentManager paymentManager, 
            ISettingsManager settingsManager, 
            IMvxMessenger messenger, IBackupManager backupManager)
        {
            this.dialogService = dialogService;
            this.paymentManager = paymentManager;
            this.settingsManager = settingsManager;
            this.backupManager = backupManager;
            this.paymentRepository = paymentRepository;
            this.accountRepository = accountRepository;

            token = messenger.Subscribe<CategorySelectedMessage>(ReceiveMessage);
        }
Beispiel #13
0
		public void Init(NavObject nav)
		{
			Username = nav.Username;
			Repository = nav.Repository;
            Simple = nav.Simple;
			_issues = new FilterableCollectionViewModel<IssueModel, IssuesFilterModel>("IssuesViewModel:" + Username + "/" + Repository);
			_issues.GroupingFunction = Group;
			_issues.Bind(x => x.Filter, () => LoadCommand.Execute(true));

			_addToken = Messenger.SubscribeOnMainThread<IssueAddMessage>(x =>
			{
				if (x.Issue == null || !DoesIssueBelong(x.Issue))
					return;
				Issues.Items.Insert(0, x.Issue);
			});

			_editToken = Messenger.SubscribeOnMainThread<IssueEditMessage>(x =>
			{
				if (x.Issue == null || !DoesIssueBelong(x.Issue))
					return;
				
				var item = Issues.Items.FirstOrDefault(y => y.LocalId == x.Issue.LocalId);
				if (item == null)
					return;

				var index = Issues.Items.IndexOf(item);

				using (Issues.DeferRefresh())
				{
					Issues.Items.RemoveAt(index);
					Issues.Items.Insert(index, x.Issue);
				}
			});

            _deleteToken = Messenger.SubscribeOnMainThread<IssueDeleteMessage>(x =>
            {
                var find = Issues.Items.FirstOrDefault(i => i.LocalId == x.Issue.LocalId);
                if (find != null)
                    Issues.Items.Remove(find);
            });

            _filterToken = Messenger.SubscribeOnMainThread<IssuesFilterMessage>(x => {
                _issues.Filter = x.Filter;
            });
		}
        public void Init(NavObject navObject) 
        {
            Username = navObject.Username;
            Repository = navObject.Repository;

            PullRequests.FilteringFunction = x => {
                var state = SelectedFilter == 0 ? "open" : "closed";
                return x.Where(y => y.State == state);
            };

            _pullRequestEditSubscription = Messenger.SubscribeOnMainThread<PullRequestEditMessage>(x =>
            {
                if (x.PullRequest == null)
                    return;
          
                var index = PullRequests.Items.IndexOf(x.PullRequest);
                if (index < 0)
                    return;
                PullRequests.Items[index] = x.PullRequest;
                PullRequests.Refresh();
            });
        }
Beispiel #15
0
        public void Init(NavObject navObject)
        {
            Username = navObject.Username;
            Repository = navObject.Repository;
            Id = navObject.Id;
			Comments.SortingFunction = x => x.OrderBy(y => y.UtcCreatedOn);

			_editToken = Messenger.SubscribeOnMainThread<IssueEditMessage>(x =>
			{
                if (x.Issue == null || x.Issue.LocalId != Issue.LocalId)
					return;
				Issue = x.Issue;
			});

            _deleteToken = Messenger.SubscribeOnMainThread<IssueDeleteMessage>(x => ChangePresentation(new MvxClosePresentationHint(this)));
        }
        public PlayerWindow_ViewModel(
            ILogger Logger_,
            INavigationService NavigationService_,
            IDialogService DialogService_,
            AppSetting AppSetting_,
            ISpeechAPI SpeechAPI_,
            IAudioAPI AudioAPI_,
            IMvxMessenger Messenger_,
            ILocalization Loc_
            ) : base()
        {
            
             
            if (!IsInDesignMode)
            {
                Logger = Logger_;
                NavigationService = NavigationService_;
                DialogService = DialogService_;
                AppSetting = AppSetting_;
                SpeechAPI = SpeechAPI_;
                AudioAPI = AudioAPI_;
                Messenger = Messenger_;
                Loc = Loc_;

                //Messenger.Default.Register<PlayerEvent>(this, Controller);
                _substoken = Messenger.Subscribe<PlayerEvent>(Controller);

                // Commands
                CommandDispatcher = new MvxCommand<string>(CmdDispatcher);

                PressCollectWordsButton_Command = new MvxCommand<ButtonModel>(PressCollectWordsButton_Cmd);
                TranslateWord_Command = new MvxCommand<PhraseOfCollectMode.Word>(TranslateWord_Cmd);

            }
            
            

            CollectPhrases_Buttons = new ObservableCollection<ButtonModel>();
            
            if (IsInDesignMode)
            {
                
                string phr = "Cakes have layers!";
                var arr = phr.Split(' ');
                foreach(var elm in arr)
                {
                    CollectPhrases_Buttons.Add(new ButtonModel {WordOfButton = new PhraseOfCollectMode.Word { word_of_phrase = elm } });
                }
                
                CollectedPhraseText = "Everybody loves cake!";

                
                //LearningItem = new LearningItem();
                //LearningItem.Statistics = new Statistics();
                //LearningItem.MainSubs = new Subtitles();
                //LearningItem.MainSubs.Items = new SynchronizedObservableCollection<SubtitleItem>();
                
                string subs_ = @"
                    Once upon a time
                    there was a lovely princess.
                    But she had an enchantment
                    upon her of a fearful sort,
                    which could only be broken
                    by love's first kiss.
                    She was locked away in a castle
                    guarded by a terrible
                    fire-breathing dragon.
                    Many brave knights had attempted
                    to free her from this dreadful prison,
                    but none prevailed.
                    She waited in the dragon's keep
                    in the highest room of the tallest tower,
                    for her true love
                    and true love's first kiss.
                    Like that's ever gonna happen.
                    What a load of...";
                arr = subs_.Split('\n');
                foreach(var elm in arr)
                {
                    //LearningItem.MainSubs.Items.Add(new SubtitleItem { Text = elm.Trim()});
                }
                //LearningItem.CollectPhrases = true;
                
            }

        }
Beispiel #17
0
 public UserGistsViewModel()
 {
     _addToken = Messenger.SubscribeOnMainThread<GistAddMessage>(x => Gists.Items.Insert(0, x.Gist));
 }
 public void Unsubscribe <TMessage>(MvxSubscriptionToken mvxSubscriptionId) where TMessage : MvxMessage
 {
     InternalUnsubscribe <TMessage>(mvxSubscriptionId.Id);
 }
 public override void Start()
 {
     _busySubscriptionToken = _messenger.Subscribe<BusyIndicatorMessage>(ChangeIsBusy);
 }
        public MyHealthClient(IMvxMessenger messenger)
        {
            _messenger = messenger;

            _serverUrl = AppSettings.ServerlUrl;
            _tenantId = AppSettings.DefaultTenantId;

            _token = _messenger.Subscribe<SettingsChangedMessage>(_ => Refresh());
        }
        public void Init(NavObject navObject)
        {
            Username = navObject.Username;
            Repository = navObject.Repository;
            Id = navObject.Id;

            _issueEditSubscription = Messenger.SubscribeOnMainThread<IssueEditMessage>(x =>
            {
                if (x.Issue == null || x.Issue.Number != Id)
                    return;
                Issue = x.Issue;
            });

            _pullRequestEditSubscription = Messenger.SubscribeOnMainThread<PullRequestEditMessage>(x =>
            {
                if (x.PullRequest == null || x.PullRequest.Number != Id)
                    return;
                PullRequest = x.PullRequest;
            });
        }
 public BaseConferenceViewModel()
 {
     _mvxSubscription = Subscribe<LoadingChangedMessage>(message => RepositoryOnLoadingChanged());
 }
        public HomeViewModel (IMyHealthClient myHealthClient, IMvxMessenger messenger) 
			: base(messenger)
		{
			_myHealthClient = myHealthClient;

			// If secutiry was enabled in Settings, I'd like this VM to load when auth. happens,
			// not before (to avoid data seen in background while auth. is happening)
			if (Settings.SecurityEnabled) {
				_loggedUserInfoChangedSubscriptionToken = _messenger.Subscribe<LoggedUserInfoChangedMessage> (
					_ => ReloadDataAsync ().Forget ());
			}
        }
        protected void Init(string username, string repository)
        {
            Username = username;
            Repository = repository;

            var messenger = GetService<IMvxMessenger>();
            _labelsToken = messenger.SubscribeOnMainThread<SelectIssueLabelsMessage>(x => Labels.Items.Reset(x.Labels));
            _milestoneToken = messenger.SubscribeOnMainThread<SelectedMilestoneMessage>(x => Milestone = x.Milestone);
            _assignedToken = messenger.SubscribeOnMainThread<SelectedAssignedToMessage>(x => AssignedTo = x.User);
        }
		protected void Init(string username, string repository)
		{
			Username = username;
			Repository = repository;

			var messenger = GetService<IMvxMessenger>();
            _milestoneToken = messenger.SubscribeOnMainThread<SelectedMilestoneMessage>(x => Milestone = x.Value);
            _versionToken = messenger.SubscribeOnMainThread<SelectedVersionMessage>(x => Version = x.Value);
            _componentToken = messenger.SubscribeOnMainThread<SelectedComponentMessage>(x => Component = x.Value);
			_assignedToken = messenger.SubscribeOnMainThread<SelectedAssignedToMessage>(x => AssignedTo = x.User);
		}
Beispiel #26
0
        public void Init(NavObject navObject)
        {
            Username = navObject.Username;
            Repository = navObject.Repository;
            Id = navObject.Id;

            _editToken = Messenger.SubscribeOnMainThread<IssueEditMessage>(x =>
            {
                if (x.Issue == null || x.Issue.Number != Issue.Number)
                    return;
                Issue = x.Issue;
            });
        }