Exemplo n.º 1
0
 public MainViewModel(ISampleAppService sampleappservice, IMvxMessenger messenger)
 {
     _sampleAppService = sampleappservice;
     ReloadList();
     _messenger = messenger;
     _listChangedToken = _messenger.Subscribe<SampleAppChangedMessage>(OnListChanged);
 }
Exemplo n.º 2
0
        public TimerService(IMvxMessenger messenger)
        {
            this.messenger = messenger;
            timerId = 0;

            StartTimer();
        }
 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);
 }
        public LocationService(IMvxGeoLocationWatcher watcher, IMvxMessenger messenger)
        {
            _messenger = messenger;

            _watcher = watcher;
            _watcher.Start(new MvxGeoLocationOptions(), OnSuccess, OnError);
        }
Exemplo n.º 5
0
        public GoalEditViewModel()
        {
            //this.DefaultViewModel["Lebensmittel"] = ds.CurrentLebensmittel;
            //this.DefaultViewModel["Items"] = ds.LebensmittelConsumed;
            //this.DefaultViewModel["SelectedConsumed"] = ds.SelectedConsumed;
            //this.DefaultViewModel["Search"] = ds.LebensmittelResult;
            //this.DefaultViewModel["CurrentLebensmittel"] = ds.CurrentLebensmittel;
            //this.DefaultViewModel["SummaryConsumedDay"] = ds.SummaryConsumedDay;
            //this.DefaultViewModel["SummaryConsumedDaytime"] = ds.SummaryConsumedDaytime;

            //SelectedConsumed = null;

            _messenger = Mvx.Resolve<IMvxMessenger>();
            //_logintoken = _messenger.Subscribe<LoggedInEvent>(a => LoginChanged(a.LoggedIn));
            _synctoken = _messenger.Subscribe<SyncEvent>(a => RaisePropertyChanged("Sync"));
            SaveDailyCommand = new MvxCommand(SaveDaily, canSaveDaily);
            NewRecord = false;

            WorkoutMinutes = new ObservableCollection<int>() { 20, 40, 60 };
            WorkoutDays = new ObservableCollection<int>() { 1, 3, 5 };

            _goal_Endurance = CurrentGoal.Goal_Endurance;
            _goal_FatLoss = CurrentGoal.Goal_FatLoss;
            _goal_Muscle = CurrentGoal.Goal_Muscle;
            OnPropertyChanged("Goal_Muscle");
            OnPropertyChanged("Goal_Endurance");
            OnPropertyChanged("Goal_FatLoss"); ;
        }
 public AddViewModel(ICollectionService collectionService, ILocationService locationService, IMvxMessenger messenger)
 {
     _collectionService = collectionService;
     _locationService = locationService;
     _token = messenger.SubscribeOnMainThread<LocationMessage>(OnLocation);
     GetInitialLocation();
 }
        public CompanyRidesViewModel(IMyShuttleClient myShuttleClient, 
            IApplicationSettingServiceSingleton applicationSettingService,
            IMvxMessenger messenger)
            : base(myShuttleClient, applicationSettingService,messenger)
	    {
            InitializeCommands();
	    }
        public TestViewModel(IMvxMessenger messenger)
        {
            _messenger = messenger;

            _receivedTokenDisposable = _messenger.Subscribe<TokenChangedMessage>(msg =>
            {
                if(msg == null) return;
                var token = msg.NewToken;
                if(token == null) return;

                Issuer = token.Issuer;
                Audience = token.Audience;
                IdentityProvider = token.IdentityProvider;
                ExpiresOn = token.ExpiresOn;
                RawToken = token.RawToken;
            });

            _loggedInTokenDisposable =
                _messenger.Subscribe<LoggedInMessage>(async msg =>
                    {
                        //Validate token here, i.e. call your Web Service
                        await Task.Delay(2000);
                        //Calling this immediately, can result in nothing happening
                        //MvxAndroidTask might still be "showing".
                        _messenger.Publish(new CloseSelfMessage(this) {Close = true});
                    });
        }
        public BaseViewModel(IMvxMessenger messenger) : base()
        {
            _messenger = messenger;

            _token = _messenger.Subscribe<ReloadDataMessage>(async _ => 
				await ReloadDataAsync());
        }
        public void LogIn(
            string url, Action<RequestSecurityTokenResponse> onLoggedIn, Action assumeCancelled,
            string identityProviderName = null)
        {
            var root = Application.Current.RootVisual as Frame;

            _messageHub = Mvx.Resolve<IMvxMessenger>();
            _subscriptionToken = _messageHub.Subscribe<RequestTokenMessage>(message =>
            {
                _response = message.TokenResponse;

                if (_response != null)
                {
                    onLoggedIn(_response);
                }
                else
                {
                    assumeCancelled();
                }

                if (root == null) return;
                if (root.CanGoBack)
                    root.GoBack();
            });

            if (root != null)
            {
                root.Navigate(
                    new Uri(
                        string.Format(
                            "/Cheesebaron.MvxPlugins.AzureAccessControl.WindowsPhone;component/Views/AccessControlWebAuthView.xaml?url={0}&name={1}",
                            WebUtility.UrlEncode(url), WebUtility.UrlEncode(identityProviderName)),
                        UriKind.Relative));
            }
        }
Exemplo n.º 11
0
 public LiveCardPresenter()
 {
     _messenger = Mvx.Resolve<IMvxMessenger>();
     _messenger.Subscribe<ServiceStartedMessage>(onServiceStart);
     _messenger.Subscribe<ServiceDestroyedMessage>(onServiceDestroyed);
     _messenger.Subscribe<GlassShowViewModelMessage>(onShowViewModel);
 }
Exemplo n.º 12
0
		public SettingsViewModel (IMvxMessenger messenger) : base()
		{
			_messenger = messenger;

			ServerAddress = AppSettings.ServerlUrl;
            AzureADAuthorizationEnabled = Settings.ADAuthenticationEnabled;
		}
Exemplo n.º 13
0
 public HomeViewModel(IDescriptionService descriptionService, IMvxMessenger messenger)
 {
     _token = messenger.SubscribeOnMainThread<TickMessage>(OnTick);
     Descriptions = descriptionService.Descriptions
                                     .Select(x => new DescriptionViewModel(x))
                                     .ToList();
 }
Exemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the SyncDataViewModel class.
        /// </summary>
        public SyncDataViewModel()
        {
            _messenger = Mvx.Resolve<IMvxMessenger>();

            _log = Mvx.Resolve<IMvxTrace>();
            sync = 0;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Konstruktor
        /// </summary>
        /// <param name="nav"></param>
        /// <param name="events"></param>
        /// <param name="sync"></param>
        public BettrFitDataSource()
        {
            _sync = new SyncDataViewModel();
            Server = "https://www.bettrfit.com";
            UserData = new UserVM();
            UserGoals = new ObservableCollection<UserGoalVM>();
            Auth = new WebAccess.ServiceReference.AuthData();
            UserDaily = new ObservableCollection<UserDailyVM>();
            NutritionPlanFavorites = new ObservableCollection<NutritionPlanFavoriteVM>();
            NutritionPlanLeb = new ObservableCollection<LebensmittelVM>();
            SummaryConsumedDaytime = new WebAccess.ServiceReference.SummaryData();
            SummaryConsumedDay = new WebAccess.ServiceReference.SummaryData();

            _messenger = Mvx.Resolve<IMvxMessenger>();
            _mapper = new InitMapper();

            _messenger.Subscribe<NetworkEvent>(m => IsNetworkAvailable = m.IsAvailable);

            LoadAll();

            CheckLogin();
            //if (ret == 0)
            //{
            //    _EventAggregator = Container.Resolve<IEventAggregator>();
            //    _EventAggregator.GetEvent<LoggedInEvent>().Publish(true);
            //    _ds._loggedIn = true;
            //}
        }
Exemplo n.º 16
0
		public JabbrService()
		{
			Connections = new ObservableCollection<JabbrConnection> ();

			Settings = Mvx.Resolve<ISettingsService> ();
			Messenger = Mvx.Resolve<IMvxMessenger> ();

			Settings.Accounts.CollectionChanged += (sender, e) => {

				if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
				{
					foreach (Account a in e.OldItems)
					{
						var cons = Connections.Where(c => c.Account.Id == a.Id);

						if (cons != null)
							foreach (var con in cons)
								con.Client.Disconnect();
					}
				}
				else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
				{
					foreach (Account a in e.NewItems)
					{
						if (Connections.Where(con => con.Account.Id == a.Id).Count() <= 0)
							AddClient(a);
					}
				}

				Messenger.Publish<AccountsChangedMessage>(new AccountsChangedMessage(this));
			};
		}
        public void LogIn(string url, Action<RequestSecurityTokenResponse> onLoggedIn, Action assumeCancelled, string identityProviderName = null)
        {
            var webAuthController = new AccessControlWebAuthController { RawUrl = url, IdentityProviderName = identityProviderName };

            _messageHub = Mvx.Resolve<IMvxMessenger>();
            _subscriptionToken = _messageHub.Subscribe<RequestTokenMessage>(message =>
            {
                webAuthController.OnCancel();

                if (message.TokenResponse != null)
                    onLoggedIn(message.TokenResponse);
                else
                    assumeCancelled();
            });

            var navControl = new UINavigationController(webAuthController)
            {
                Title = identityProviderName,
                NavigationBarHidden = false,
            };
            webAuthController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Done,
                (sender, args) =>
                {
                    webAuthController.OnCancel();
                    assumeCancelled();
                });

            var modalHost = Mvx.Resolve<IMvxTouchModalHost>();
            modalHost.PresentModalViewController(navControl, true);
        }
Exemplo n.º 18
0
        public MyRidesViewModel(
            IMyShuttleClient myShuttleClient, 
            IApplicationSettingServiceSingleton applicationSettingService,
            IMvxMessenger messenger)
        {
            if (myShuttleClient == null)
            {
                throw new ArgumentNullException("myShuttleClient");
            }

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

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

            _myShuttleClient = myShuttleClient;
            _applicationSettingService = applicationSettingService;
            _messenger = messenger;

            _token = _messenger.Subscribe<ReloadDataMessage>(_ => InitializeActions());
            
            InitializeActions();

            InitializeCommands();
        }
        public AddIncidentDetailViewModel(INetworkService networkService, IUserDialogs userDialogs, IAzureService azureService, IMvxMessenger messenger)
            : base(networkService, userDialogs)
        {
            _azureService = azureService;
            _messenger = messenger;

        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _messageHub = Mvx.Resolve<IMvxMessenger>();

            var url = Intent.GetStringExtra("cheesebaron.mvxplugins.azureaccesscontrol.droid.Url");

            Window.RequestFeature(WindowFeatures.Progress);

            _webView = new WebView(this)
            {
                VerticalScrollBarEnabled = true,
                HorizontalScrollBarEnabled = true,
                ScrollBarStyle = ScrollbarStyles.OutsideOverlay,
                ScrollbarFadingEnabled = true
            };

            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);
            _webView.Settings.BuiltInZoomControls = true;
            _webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            
            var notify = new AccessControlJavascriptNotify();
            notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            _webView.AddJavascriptInterface(notify, "external");
            _webView.SetWebViewClient(new AuthWebViewClient());
            _webView.SetWebChromeClient(new AuthWebChromeClient(this));

            _webView.LoadUrl(url);

            AddContentView(_webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
        }
 /// <summary>
 ///     Creates an CategoryListViewModel for the usage of providing a CategoryViewModel selection.
 /// </summary>
 /// <param name="categoryRepository">An instance of <see cref="IRepository{T}" />.</param>
 /// <param name="modifyDialogService">An instance of <see cref="IModifyDialogService" /></param>
 /// <param name="dialogService">An instance of <see cref="IDialogService" /></param>
 /// <param name="messenger">An instance of <see cref="IMvxMessenger" /></param>
 public SelectCategoryListViewModel(ICategoryRepository categoryRepository,
     IModifyDialogService modifyDialogService,
     IDialogService dialogService, IMvxMessenger messenger) 
     : base(categoryRepository, modifyDialogService, dialogService)
 {
     this.messenger = messenger;
 }
Exemplo n.º 22
0
        public DataViewModel(IMvxMessenger hub, IDataStorage<DataSample> data)
        {
            this.hub = hub;
            this.data = data;

            this.mvxSubscriptionToken = hub.Subscribe<NewDataMessage>(a => this.RaisePropertyChanged(() => this.DataList));
        }
Exemplo n.º 23
0
        public SettingsViewModel(
            IApplicationSettingServiceSingleton applicationSettingService, 
            IMvxMessenger messenger,IUserInteraction userInteraction)
        {
            
            if (applicationSettingService == null)
            {
                throw new ArgumentNullException("applicationSettingService");
            }

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

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

            _applicationSettingService = applicationSettingService;
            _messenger = messenger;
            _userInteraction = userInteraction;

            this.InitializeCommands();
            this.InitializeActions();
        }
Exemplo n.º 24
0
 public HomeViewModel(IStorageService storageService, IMvxMessenger messenger, IPopupHelper helper, IMessageService messageService)
     : base(messenger, helper)
 {
     _storageService = storageService;
     _messageService = messageService;
     SelectContactCommand = new MvxCommand<ContactListItem>(SelectContactCommandAction);
 }
Exemplo n.º 25
0
        public ScanViewModel(IMvxMessenger mvxMessenger)
        {
            _mvxMessenger = mvxMessenger;

            _scanSubscriptionTokenToken =
                _mvxMessenger.Subscribe<ScanMessage>(OnScan);
        }
 public StatisticCategorySpreadingViewModel(CategorySpreadingDataProvider spreadingDataProvider,
     ISettingsManager settingsManager,
     IMvxMessenger messenger) : base(messenger)
 {
     this.spreadingDataProvider = spreadingDataProvider;
     this.settingsManager = settingsManager;
 }
Exemplo n.º 27
0
        public MainViewModel(IOCRService ocrService, IMvxPictureChooserTask pictureChooser, IMvxMessenger messenger)
        {
            OCRService = ocrService;
            PictureChooser = pictureChooser;
            Messenger = messenger;

            Messenger.Subscribe<PictureMessage>(async msg => await OnPictureReceivedAsync(msg));
        }
 public StatePickerViewModel(IPropertyTrackerService propertyTrackerService, IGeoDataService geoService, IUserDialogService dialogService, IMvxMessenger messenger)
 {
     _propertyTrackerService = propertyTrackerService;
     _geoService = geoService;
     _dialogService = dialogService;
     _messenger = messenger;
     States = new ObservableCollection<string>();
 }
Exemplo n.º 29
0
 public InboxService(IInboxRepository inboxRepository, 
                     IMvxMessenger mvxMessenger)
 {
     // this wont get initialized from the Mvx IoC
     // so we do it here
     _inboxRepository = inboxRepository;
     _mvxMessenger = mvxMessenger;
 }
Exemplo n.º 30
0
        public FlashCardManager(ISQLiteConnection connection, IMvxMessenger messenger)
        {
            _messenger = messenger;

            _connection = connection.connection;
            _connection.CreateTable<FlashCardSet>();
            _connection.CreateTable<FlashCard>();
        }
Exemplo n.º 31
0
 public StatisticCategorySummaryViewModel(CategorySummaryDataProvider categorySummaryDataDataProvider,
                                          IMvxMessenger messenger) : base(messenger)
 {
     this.categorySummaryDataDataProvider = categorySummaryDataDataProvider;
 }
Exemplo n.º 32
0
 public GistsViewModel(IGistDataService gistDataService, IGithubClientService githubClientService, IMvxMessenger messenger, IDialogService dialogService) : base(githubClientService, messenger, dialogService)
 {
     _gistDataService = gistDataService;
 }
Exemplo n.º 33
0
 public PhoneService(IQryptoWireServiceClient serviceClient, IMvxMessenger messenger, IMessageService messageService)
 {
     _serviceClient  = serviceClient;
     _messenger      = messenger;
     _messageService = messageService;
 }
Exemplo n.º 34
0
 public HomeViewModel(IGenerateDataService generateDataService, IDataService <SlidersData> dataService, IMvxMessenger messenger)
 {
     _generateDataService = generateDataService;
     _dataService         = dataService;
     _messenger           = messenger;
 }
Exemplo n.º 35
0
 public MenuViewModel(IMvxMessenger messenger) : base(messenger)
 {
     MenuItems = new ObservableCollection <MenuItem>();
     CreateMenuItems();
 }
Exemplo n.º 36
0
 public void Dispose()
 {
     Messenger = null;
 }
Exemplo n.º 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DraftsViewModel"/> class.
 /// </summary>
 /// <param name="messenger">The messenger.</param>
 public DraftsViewModel(IMvxMessenger messenger)
     : base(messenger)
 {
 }
 public DetalleViewModel(IServicioDatos servicioDatos, IMvxMessenger messenger)
 {
     _servicioDatos = servicioDatos;
     _messenger     = messenger;
     CmdBorrar      = new MvxCommand(RunBorrar);
 }
        public SettingsViewModel(IMvxMessenger messenger) : base()
        {
            _messenger = messenger;

            ServerAddress = AppSettings.ServerlUrl;
        }
 public InstallerSearchViewModel(IMvxMessenger messenger, IMobileDataService dataService) : base(messenger)
 {
     _dataService  = dataService;
     SearchCommand = new MvxAsyncCommand(SearchCommandHandler);
     _validator    = new InstallerSearchValidator();
 }
 public OrderDetailViewModel(Services.IErpService erpService, Services.IContextService contextService, IMvxNavigationService navigationService, IMvxMessenger messenger, IAuthenticationService authenticationService)
 {
     this.erpService        = erpService;
     this.contextService    = contextService;
     this.navigationService = navigationService;
     this.messenger         = messenger;
     this.CurrentUserName   = authenticationService.UserName;
     this.BeginEditCommand  = new MvxAsyncCommand(OnBeginEditOrder);
     this.DeleteCommand     = new MvxAsyncCommand(OnDeleteOrder);
     this.CommitCommand     = new MvxAsyncCommand(OnCommitEditOrder);
     this.CancelCommand     = new MvxAsyncCommand(OnCancel);
     this.AllProducts       = new Telerik.XamarinForms.Common.ObservableItemCollection <OrderDetail>();
     this.AllProducts.ItemPropertyChanged += OnAllProductsItemPropertyChanged;
     this.orderSearchPerformedMessageToken = messenger
                                             .SubscribeOnMainThread <OrderSearchPerformedMessage>((obj) => IsSearchEmpty = obj.IsEmpty);
     this.emptyImageName = "Item_add.png";
 }
Exemplo n.º 42
0
        public MapsViewModel(IMvxNavigationService navigationService, ITaskService taskService, IMvxMessenger messenger, IAlertService alertService)
            : base(navigationService)
        {
            _taskService              = taskService;
            _messenger                = messenger;
            _alertService             = alertService;
            _token                    = messenger.Subscribe <MapMessenger>(OnLocationMessage);
            BackTaskCommand           = new MvxAsyncCommand(BackMap);
            SaveMapPointCommand       = new MvxAsyncCommand(SaveMapPoint);
            NativeSaveMapPointCommand = new MvxAsyncCommand(NativeSaveMapPoint);

            if (Connectivity.NetworkAccess == NetworkAccess.Internet)
            {
                ChangedNetworkAccess = true;
            }
            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
        }
Exemplo n.º 43
0
 public ShareViewModel(IPatternClient client, IFavoritesService favoritesService, IImageService imageService,
                       IMvxMessenger messenger) : base(client, favoritesService, imageService, messenger)
 {
 }
Exemplo n.º 44
0
 public BaseViewModel(IMvxMessenger messenger)
 {
     Messenger = messenger;
 }
Exemplo n.º 45
0
        public CommentsViewModel(IParentService parentService, IUserDialogs userDialogs,
                                 IMvxMessenger mvxMessenger, AppHelper appHelper) : base(userDialogs, mvxMessenger, appHelper)
        {
            _parentService = parentService;


            RefreshCommand = ReactiveCommand
                             .CreateFromObservable <Unit, IList <CommentEntity> >((param) =>
            {
                if (PopupNavigation.PopupStack.Count > 0)
                {
                    PopupNavigation.PopAllAsync();
                }

                return(_parentService.GetComments(SonIdentity, AuthorIndentity, TimeIntervalOption.Value, SocialMediaFilter, DimensionsFilter));
            });

            RefreshCommand.Subscribe((CommentEntities) =>
            {
                Comments.ReplaceRange(CommentEntities);
                ResetCommonProps();
            });

            RefreshCommand.IsExecuting.Subscribe((IsLoading) => IsBusy = IsLoading);

            RefreshCommand.ThrownExceptions.Subscribe(HandleExceptions);


            AllDimensionCategory.PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == "IsFiltered")
                {
                    foreach (var category in DimensionCategories)
                    {
                        category.IsEnabled = !AllDimensionCategory.IsFiltered;
                        if (AllDimensionCategory.IsFiltered)
                        {
                            category.IsFiltered = true;
                        }
                    }

                    Debug.WriteLine(DimensionsFilter);
                }
            };

            foreach (DimensionCategoryModel dimension in DimensionCategories)
            {
                dimension.PropertyChanged += (sender, e) =>
                {
                    var Dimension = sender as DimensionCategoryModel;

                    if (e.PropertyName == "IsFiltered")
                    {
                        Debug.WriteLine("Dimension -> " + dimension.Type + " Value -> " + dimension.IsFiltered);
                        if (Dimension.IsFiltered)
                        {
                            DimensionsFilter[dimension.Type] = "POSITIVE";
                        }
                        else
                        {
                            DimensionsFilter[dimension.Type] = "NEGATIVE";
                        }
                    }
                };
            }

            AllSocialMediaCategory.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) =>
            {
                if (e.PropertyName == "IsFiltered")
                {
                    foreach (var category in SocialMediaCategories)
                    {
                        category.IsEnabled = !AllSocialMediaCategory.IsFiltered;
                        if (AllSocialMediaCategory.IsFiltered)
                        {
                            category.IsFiltered = true;
                        }
                    }

                    Debug.WriteLine(SocialMediaFilter);
                }
            };

            foreach (SocialMediaCategoryModel socialMedia in SocialMediaCategories)
            {
                socialMedia.PropertyChanged += (sender, e) =>
                {
                    var SocialMedia = sender as SocialMediaCategoryModel;

                    if (e.PropertyName == "IsFiltered")
                    {
                        if (SocialMedia.IsFiltered)
                        {
                            SocialMediaFilter.Add(SocialMedia.Type);
                        }
                        else
                        {
                            SocialMediaFilter.Remove(SocialMedia.Type);
                        }
                    }
                };
            }
        }
Exemplo n.º 46
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DriveInViewModel" /> class.
 /// </summary>
 /// <param name="logFactory">The log provider.</param>
 /// <param name="navigationService">The navigation service.</param>
 public DriveInViewModel(ILoggerFactory logFactory, IMvxNavigationService navigationService, IMvxMessenger messenger, IRideService rideService)
     : base(logFactory, navigationService)
 {
     _rideService = rideService;
     _messenger   = messenger;
     ResetCommand = new MvxCommand(ResetDriveIn);
     StartCommand = new MvxCommand(() => _messenger.Publish(new MvxTabIndexMessenger(this, 1)));
 }
        public async Task HandleActionAsync(IMvxNavigationService navigationService, IAlertService alertService, IMvxMessenger messenger, FeedActionModel model, string actionType = null, string AreaGUID = null)
        {
            _navigationService         = navigationService;
            _alertService              = alertService;
            _messenger                 = messenger;
            _platformNavigationService = Mvx.Resolve <IPlatformNavigationService>();
            if (model == null)
            {
                return;
            }
            if ((model.ActionScreen == ActionTypeConstants.ChallengeActionType || actionType == ActionTypeConstants.ReferralAcceptedActionType ||
                 actionType == ActionTypeConstants.ItbCompletedActionType || actionType == ActionTypeConstants.CtacActionType) && model.ActionScreen != ActionTypeConstants.DialogActionType)
            {
                OpenChallengeDetailsScreenWithURL(model.ActionParamDict[ActionTypeConstants.ChallengeDetailURLActionParamDict]);
                return;
            }
            if (model.ActionScreen == ActionTypeConstants.RewardActionType)
            {
                await SL.Manager.GetRewardByUrl(model.ActionParamDict[ActionTypeConstants.RewardDetailURLActionParamDict], GetRewardByUrlComplete);

                return;
            }
            if (model.ActionScreen == ActionTypeConstants.RewardListActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.REWARDS);
            }
            if (model.ActionScreen == ActionTypeConstants.ChallengeListActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.CHALLENGES);
            }
            if (model.ActionScreen == ActionTypeConstants.FeedActionType)
            {
                string feedUrl = string.Empty;
                model.ActionParamDict.TryGetValue(ActionTypeConstants.FeedURLActionParamDict, out feedUrl);
                if ((actionType == ActionTypeConstants.AggChalcompActionType) || (actionType == ActionTypeConstants.AggCommitActionType))
                {
                    await LoadFeedByUrl(feedUrl);
                }
                else
                {
                    await LoadFeedByUrl(feedUrl, true);
                }
            }
            if (model.ActionScreen == ActionTypeConstants.WebActionType)
            {
                string url    = string.Empty;
                bool   gotUrl = model.ActionParamDict.TryGetValue(ActionTypeConstants.WebRequestURLActionParamDict, out url);
                if (gotUrl == false)
                {
                    url = model.WebRequestURL;
                }
                if (url == string.Empty)
                {
                    _alertService.ShowToast("There isn't url to open");
                }
                _platformNavigationService.NavigateToUrl(url);
            }
            if (model.ActionScreen == ActionTypeConstants.SettingsActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.MORE);
            }
            if (model.ActionScreen == ActionTypeConstants.ShareActionType)
            {
                if (!model.ActionParamDict.ContainsKey(ActionTypeConstants.ChallengeDetailURLActionParamDict))
                {
                    return;
                }

                OpenChallengeDetailsScreenWithURL(model.ActionParamDict[ActionTypeConstants.ChallengeDetailURLActionParamDict]);
            }
            if (model.ActionScreen == ActionTypeConstants.SwitchAreaActionType)
            {
                await SwitchAreaIfNeeded(AreaGUID);
            }
            if (model.ActionScreen == ActionTypeConstants.InviteActionType)
            {
                await SL.Manager.RefreshShareTemplate(model.ActionParamDict[ActionTypeConstants.ShareTemplateURLActionParamDict], SendInviteMessage);
            }
            if (model.ActionScreen == ActionTypeConstants.DialogActionType)
            {
                var dialogStyle = model.ActionParamDict[ActionTypeConstants.DialogStyleActionParamDict];
                _dialogSubmisionUrl = model.ActionParamDict[ActionTypeConstants.SubmissionURLActionParamDict];

                var message = model.ActionParamDict[ActionTypeConstants.CaptionActionParamDict];
                if (dialogStyle != string.Empty)
                {
                    if (dialogStyle == ActionTypeConstants.NoneDialogStyle)
                    {
                    }
                    if (dialogStyle == ActionTypeConstants.EntryDialogStyle)
                    {
                        var result = await _alertService.ShowAlertWithInput("", message, string.Empty, "Ok", "Cancel");

                        Dismissed(result);
                    }
                }
            }

            if (model.ActionScreen == ActionTypeConstants.IWebActionType && actionType == ActionTypeConstants.CtaiwActionType)
            {
                string actionUrl = string.Empty;
                bool   gotUrl    = model.ActionParamDict.TryGetValue(ActionTypeConstants.WebRequestURLActionParamDict, out actionUrl);
                if (string.IsNullOrEmpty(actionUrl))
                {
                    var firstUrl = model.ActionParamDict.Values.Count > 0 ? model.ActionParamDict.Values.FirstOrDefault() : string.Empty;
                    actionUrl = model.ActionParamDict[ActionTypeConstants.WebRequestURLActionParamDict] ?? firstUrl;
                }
                if (gotUrl == false)
                {
                    //url = model.WebRequestURL;
                }
                if (string.IsNullOrEmpty(actionUrl))
                {
                    _alertService.ShowToast("There isn't url to open");
                    return;
                }

                //actionUrl = "https://goo.gl/?link=" + actionUrl;
                await _navigationService.Navigate <WebViewModel>();

                _messenger.Publish <MessangerWebModel>(new MessangerWebModel(this, actionUrl, true));
                return;
            }

            if (model.ActionScreen == ActionTypeConstants.IWebActionType)
            {
                string url    = string.Empty;
                bool   gotUrl = model.ActionParamDict.TryGetValue(ActionTypeConstants.WebRequestURLActionParamDict, out url);
                if (gotUrl == false)
                {
                    url = model.WebRequestURL;
                }
                if (url == string.Empty)
                {
                    _alertService.ShowToast("There isn't url to open");
                }
                _platformNavigationService.NavigateToUrl(url);
            }
            if (model.ActionScreen == ActionTypeConstants.ScoreActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.POINTS);
            }
            if (model.ActionScreen == ActionTypeConstants.FriendListActionType)
            {
                NavigateByAction("Main", "MainNav1", ENavigationTabs.POINTS);
            }
        }
 public IncrementalLoadingNewestViewModel(IPatternClient client, IMvxMessenger messenger)
 {
     _client    = client;
     _messenger = messenger;
     _items     = new IncrementalLoadingNew(client);
 }
Exemplo n.º 49
0
 public ChatViewModel(IMvxNavigationService navigationService, IChatService chatService, IMvxMessenger messenger)
 {
     _navigationService            = navigationService;
     _chatService                  = chatService;
     _chatMessageSubscriptionToken = messenger.Subscribe <ChatMessage>(OnNewMessage);
     ChatItemViewModels            = new MvxObservableCollection <ChatItemViewModel>();
     this.SubscribeSearchText(nameof(SearchText), SearchCommand, () => !IsLoading && !IsRefreshing);
 }
Exemplo n.º 50
0
 public AddContactViewModel(IQrService qrService, IMessageService messageService, IMvxMessenger messenger, IPopupHelper helper) : base(messenger, helper)
 {
     _qrService          = qrService;
     _messageService     = messageService;
     CodeDetectedCommand = new MvxCommand <string>(CodeDetectedCommandAction);
     AddContactCommand   = new MvxCommand(AddContactCommandAction, AddContactCanExecute);
 }
Exemplo n.º 51
0
        public WeatherTabsViewModel(IWeatherService weatherService, IMvxNavigationService navigationService, IMvxMessenger messenger)
        {
            //Subcriben aan de locatiemessage
            _messenger = messenger;
            _token     = messenger.Subscribe <LocationMessage>(OnLocationMessage);

            //OnLocationMessage();

            //Navigeren
            _navigationService = navigationService;

            //Weer service
            this._weatherService = weatherService;

            //initialize lazy instance via ioc construct
            _weatherViewModel      = new Lazy <WeatherViewModel>(Mvx.IocConstruct <WeatherViewModel>);
            _tabDetailsViewModel   = new Lazy <TabDetailsViewModel>(Mvx.IocConstruct <TabDetailsViewModel>);
            _tabWeekTableViewModel = new Lazy <TabWeekTableViewModel>(Mvx.IocConstruct <TabWeekTableViewModel>);
        }
Exemplo n.º 52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SentDetailsViewModel"/> class.
 /// </summary>
 /// <param name="messenger">The messenger.</param>
 public SentDetailsViewModel(IMvxMessenger messenger) : base(messenger)
 {
 }
Exemplo n.º 53
0
 public HttpClientService(IMvxMessenger messenger)
 {
     _messenger = messenger;
 }
Exemplo n.º 54
0
 public SearchViewModel(IDataService dataService, IMvxMessenger messenger, IBackupService oneDriveService)
     : base(dataService, messenger, oneDriveService)
 {
     _dataService = dataService;
 }
Exemplo n.º 55
0
 public MenuViewModel(IMvxMessenger messenger, ICurrentUserContext userContext, ILocalizationProvider localizationProvider) : base(messenger, userContext, localizationProvider)
 {
 }
Exemplo n.º 56
0
 public LessonsViewModel(IMvxMessenger messenger, ILessonDbDataService lessonDataService)
 {
     this._messenger         = messenger;
     this._lessonDataService = lessonDataService;
 }
Exemplo n.º 57
0
 public BaseViewModel(IMvxNavigationService navigationService, IMvxMessenger messenger)
 {
     _navigationService = navigationService;
     _messenger         = messenger;
 }
Exemplo n.º 58
0
 public RewardCategoriesViewModel(IMvxNavigationService navigationService, IAlertService alertService, IPlatformAssetService assetService, ILocalNotificationService localNotificationService, IMvxMessenger messanger) : base(navigationService, alertService, assetService, localNotificationService, messanger)
 {
     BackButtonHidden = false;
     _refreshCommand  = new MvxAsyncCommand(Refresh);
     _onRewardCategorySelectedCommand = new MvxAsyncCommand <RewardItemModel>(OnRewardCategorySelected);
     PlaceholderModel = LocalPlaceholderHelper.GetRewardsPlacehplder();
 }
Exemplo n.º 59
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OutboxViewModel" /> class.
 /// </summary>
 /// <param name="messenger">The messenger.</param>
 public OutboxViewModel(IMvxMessenger messenger)
     : base(messenger)
 {
 }
 protected BaseUserViewModel(IPropertyTrackerService service, IUserDialogService dialogService, IMvxPictureChooserTask pictureChooserTask, IMvxMessenger messenger)
 {
     _propertyTrackerService = service;
     _dialogService          = dialogService;
     _pictureChooserTask     = pictureChooserTask;
     _messenger  = messenger;
     _properties = new List <Property>();
     UserId      = -1;
     RegisterSubscriptions();
 }