public ConnctionService(OmvServiceProvider omvServiceProvider, SshServiceProvider sshServiceProvider, SynoServiceProvider synoServiceProvider, WebminServiceProvider webminServiceProvider, IMessageBoxService messageBoxService, IDataProvider dataProvider, IMessagingCenter messagingCenter, IPreferences preferences) { _omvServiceProvider = omvServiceProvider; _sshServiceProvider = sshServiceProvider; _synoServiceProvider = synoServiceProvider; _webminServiceProvider = webminServiceProvider; _messageBoxService = messageBoxService; _dataProvider = dataProvider; _messagingCenter = messagingCenter; _preferences = preferences; _messagingCenter.Subscribe <string, string>( this, MessengerKeys.SessionExpired, async(sender, arg) => { await Init(); }); _messagingCenter.Subscribe <DataProvider, TableBase>( this, MessengerKeys.ItemChanged, async(sender, arg) => { if (arg is Host) { await Init(); } }); }
public AddStepViewModel(IMessagingCenter messagingCenter, INavigationService navigationService) { _messagingCenter = messagingCenter; _navigationService = navigationService; Save = new Command(async() => await SaveStep()); }
public AimTimersViewModel( IDateTimeProvider dateTimeProvider, ITimer timer, IAimTimerNotificationService aimTimerNotificationService, INavigation navigation, IAlertManager alertManager, IMessagingCenter messagingCenter, IViewFactory viewFactory, IAimTimerService aimTimerService, IAimTimerListItemViewModelFactory aimTimerItemViewModelFactory, IAimTimerViewModelFactory aimTimerViewModelFactory, Func <DateTime, IAimTimer> aimTimerFactory, Func <IAimTimer, IAimTimerItem> aimTimerItemFactory) { _dateTimeProvider = dateTimeProvider; _timer = timer; _aimTimerNotificationService = aimTimerNotificationService; _navigation = navigation; _alertManager = alertManager; _messagingCenter = messagingCenter; _viewFactory = viewFactory; _aimTimerService = aimTimerService; _aimTimerItemViewModelFactory = aimTimerItemViewModelFactory; _aimTimerViewModelFactory = aimTimerViewModelFactory; _aimTimerFactory = aimTimerFactory; _aimTimerItemFactory = aimTimerItemFactory; }
public SuperheroesViewModel(INavigationService navigation, IMessagingCenter messaging, IRestClient client) { _navigation = navigation; _messaging = messaging; _client = client; Title = "Browse"; LoadCommand = new Command(async() => await ExecuteLoadCommand(), () => !IsBusy); NewCommand = new Command(async() => await ExecuteNewCommand(), () => !IsBusy); ViewCommand = new Command(async() => await ExecuteViewCommand(), () => !IsBusy); _messaging.Subscribe <SuperheroCreateViewModel, SuperheroListDTO>(this, AddSuperhero, (obj, superhero) => { Items.Add(superhero); }); _messaging.Subscribe <SuperheroUpdateViewModel, SuperheroListDTO>(this, Message, (obj, superhero) => { var existing = Items.FirstOrDefault(h => h.Id == superhero.Id); if (existing != null) { Items.Remove(existing); } Items.Add(superhero); }); _messaging.Subscribe <SuperheroDetailsViewModel, int>(this, DeleteSuperhero, (obj, superheroId) => { var existing = Items.FirstOrDefault(h => h.Id == superheroId); if (existing != null) { Items.Remove(existing); } }); }
public SysopGlobal(IAccountRepository accountRepository, IAccountKeyRepository accountKeyRepository, IGlobalCache globalCache, IMessagingCenter messagingCenter) { _accountRepository = accountRepository; _accountKeyRepository = accountKeyRepository; _globalCache = globalCache; _messagingCenter = messagingCenter; }
/// <summary> /// Constructor /// </summary> /// <exception cref="InvalidOperationException"></exception> public NativeBackgroundServiceHost() { _messagingCenter = MessagingCenter.Instance; if (_backgroundServiceCreationFunc == null) { throw new InvalidOperationException("You must call NativeBackgroundServiceHost.Init() before instantiate it"); } //_locationManager = new CLLocationManager //{ // PausesLocationUpdatesAutomatically = false //}; //if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) //{ // _locationManager.RequestAlwaysAuthorization(); //} //if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0)) // _locationManager.AllowsBackgroundLocationUpdates = true; //_locationManager.DesiredAccuracy = 1; //_locationManager.ActivityType = CLActivityType.Other; //_locationManager.ShowsBackgroundLocationIndicator = true; }
public ChallengeViewModel(IMvxNavigationService navigationService, IStorageHelper storageHelper, IMessagingCenter messagingCenter, IPopupNavigationService popupNavigationService) { _navigationService = navigationService; _storageHelper = storageHelper; _messagingCenter = messagingCenter; _popupNavigationService = popupNavigationService; _challengeList = new MvxObservableCollection <Challenge>(); }
public AimTimerViewModelFactory( INavigation navigation, IMessagingCenter messagingCenter, IAimTimerService aimTimerService) { _navigation = navigation; _messagingCenter = messagingCenter; _aimTimerService = aimTimerService; }
/// <summary> /// Subscribes to a message with preventing multiple subscription. /// </summary> public static void SubscribeSafe <TSender, TArgs>(this IMessagingCenter messagingCenter, object subscriber, string message, Action <TSender, TArgs> callback, TSender source = null) where TSender : class { MessagingCenter.Unsubscribe <TSender>(subscriber, message); MessagingCenter.Subscribe(subscriber, message, callback, source); }
/// <summary> /// Constructor /// </summary> /// <exception cref="InvalidOperationException"></exception> public NativeBackgroundServiceHost() { _messagingCenter = MessagingCenter.Instance; if (_backgroundServiceHostBuilder == null) { throw new InvalidOperationException("You must call NativeBackgroundServiceHost.Init() before instantiate it"); } _backgroundService = _backgroundServiceHostBuilder.Build(); }
public SuperheroUpdateViewModel(INavigationService navigation, IMessagingCenter messaging, IRestClient client) { _navigation = navigation; _messaging = messaging; _client = client; LoadCommand = new Command(o => ExecuteLoadCommand((SuperheroDetailsDTO)o), _ => !IsBusy); SaveCommand = new Command(async() => await ExecuteSaveCommand(), () => !IsBusy); CancelCommand = new Command(async() => await ExecuteCancelCommand(), () => !IsBusy); }
public MapModalViewModel( INavigationService navigationService, IMessagingCenter messagingCenter) { _navigationService = navigationService; _messagingCenter = messagingCenter; ConfirmCommand = CreateCommand(Confirm); CancelCommand = CreateCommand(Cancel); }
/// <summary> /// Constructor /// </summary> /// <exception cref="NullReferenceException"></exception> public NativeBackgroundServiceHost() { if (_backgroundServiceCreationFunc == null) { throw new NullReferenceException("You probably forgot to call Init() method for this class"); } _binder = new BackgroundServiceBinder(this); _messagingCenter = MessagingCenter.Instance; }
public SuperheroCreateViewModel(INavigationService navigation, IMessagingCenter messaging, IRestClient client) { _navigation = navigation; _messaging = messaging; _client = client; Title = "New Superhero"; SaveCommand = new Command(async() => await ExecuteSaveCommand(), () => !IsBusy); CancelCommand = new Command(async() => await ExecuteCancelCommand(), () => !IsBusy); }
public NewItemViewModel(INavigationService navigationService, IMessagingCenter messagingCenter) { this.navigationService = navigationService; this.messagingCenter = messagingCenter; Item = new Item { Text = "Item name", Description = "This is an item description." }; }
public OpenmediavaultDashboardViewModel(IOmvService omvService, IConfiguration configuration, IMessagingCenter messagingCenter) { _OmvService = omvService; UpdatesCmd = new Command(async(obj) => await Updates(obj)); CheckCmd = new Command(async(obj) => await Check(obj)); ManageHostsCmd = new Command(ManageHosts); ChangeHostCmd = new Command(async(obj) => await ChangeHost()); ShowDetailsCmd = new Command(ShowDetails); BannerId = configuration.AdsKey; _messagingCenter = messagingCenter; }
/// <summary> /// Subscribes to a message with preventing multiple subscription with async calback /// </summary> public static void SubscribeSafe <TArgs>(this IMessagingCenter messagingCenter, object subscriber, string message, Func <TArgs, Task> callback, TArgs source = null) where TArgs : class { MessagingCenter.Unsubscribe <TArgs>(subscriber, message); MessagingCenter.Subscribe(subscriber, message, async(arg) => { await callback(arg); }, source); }
/// <inheritdoc /> public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions) { var result = base.FinishedLaunching(uiApplication, launchOptions); _messagingCenter = MessagingCenter.Instance; _messagingCenter.Subscribe <object>(this, ToBackgroundMessages.StartBackgroundService, OnStartBackgroundServiceMessage); _messagingCenter.Subscribe <object>(this, ToBackgroundMessages.StopBackgroundService, OnStopBackgroundServiceMessage); _messagingCenter.Subscribe <object>(this, ToBackgroundMessages.GetBackgroundServiceState, OnGetBackgroundServiceState); BackgroundService = new NativeBackgroundServiceHost(); return(result); }
public BaseViewModel(IMessagingCenter messagingCenter, IGameService gameService, IGameHubService gameHubService, ILocalStorageService localStorageService) { MessagingCenter = messagingCenter; GameService = gameService; GameHubService = gameHubService; LocalStorageService = localStorageService; TryReconnectCommand = new Command(async() => await OnTryReconnectAsync(), CanTryReconnect); messagingCenter.Subscribe <GameHubService, ConnectionStateChangedMessage>(this, nameof(ConnectionStateChangedMessage), HandleConnectionStateChanged); }
public SuperheroDetailsViewModel(INavigationService navigation, IMessagingCenter messaging, IRestClient client) { _navigation = navigation; _messaging = messaging; _client = client; LoadCommand = new Command(async o => await ExecuteLoadCommand(o as SuperheroListDTO), _ => !IsBusy); EditCommand = new Command(async _ => await ExecuteEditCommand(), _ => !IsBusy); DeleteCommand = new Command(async _ => await ExecuteDeleteCommand(), _ => !IsBusy); _messaging.Subscribe <SuperheroUpdateViewModel, SuperheroDetailsDTO>(this, UpdateSuperhero, (obj, superhero) => { SetSuperhero(superhero); }); }
public MainPageViewModel(INavigationService navigationService, IUserDialogs userDialogs, IMessagingCenter messagingCenter, IRandomUploadService randomUploadService) : base(navigationService) { Title = "Main Page"; UserDialogs = userDialogs; MessagingCenter = messagingCenter; RandomUploadService = randomUploadService; PushRandomCommand = new Command(() => Push()); // TODO: It is obvious that I only need one of these. Please fixe, I started out with only 2 MessagingCenter.Subscribe <IUploadStateMessenger, string>(this, Constants.Running, async(sender, id) => { await UserDialogs.AlertAsync($"Message received {id}", Constants.Running, "OK"); }); MessagingCenter.Subscribe <IUploadStateMessenger, string>(this, Constants.Blocked, async(sender, id) => { await UserDialogs.AlertAsync($"Message received {id}", Constants.Blocked, "OK"); }); MessagingCenter.Subscribe <IUploadStateMessenger, string>(this, Constants.Enqueued, async(sender, id) => { await UserDialogs.AlertAsync($"Message received {id}", Constants.Enqueued, "OK"); }); MessagingCenter.Subscribe <IUploadStateMessenger, string>(this, Constants.Cancelled, async(sender, id) => { await UserDialogs.AlertAsync($"Message received {id}", Constants.Cancelled, "OK"); }); MessagingCenter.Subscribe <IUploadStateMessenger, string>(this, Constants.Failed, async(sender, id) => { await UserDialogs.AlertAsync($"Message received {id}", Constants.Failed, "OK"); }); MessagingCenter.Subscribe <IUploadStateMessenger, string>(this, Constants.Succeeded, async(sender, id) => { var imageUpload = ImageUploads.SingleOrDefault(x => x.TaskId == id); if (imageUpload != null) { await UserDialogs.AlertAsync($"Message received {id}", Constants.Succeeded, "OK"); } }); }
public AimTimerListItemViewModelFactory( IDateTimeProvider dateTimeProvider, IAlertManager alertManager, INavigation navigation, IMessagingCenter messagingCenter, IAimTimerService aimTimerService, IViewFactory viewFactory, IAimTimerIntervalListItemViewModelFactory aimTimerIntervalListItemViewModelFactory, Func <IAimTimerItem, DateTime, DateTime?, IAimTimerInterval> aimTimerIntervalFactory, Func <IAimTimerItem, IAimTimerInterval, IAimTimerIntervalViewModel> aimTimerIntervalViewModelFactory) { _dateTimeProvider = dateTimeProvider; _alertManager = alertManager; _navigation = navigation; _messagingCenter = messagingCenter; _aimTimerService = aimTimerService; _viewFactory = viewFactory; _aimTimerIntervalListItemViewModelFactory = aimTimerIntervalListItemViewModelFactory; _aimTimerIntervalFactory = aimTimerIntervalFactory; _aimTimerIntervalViewModelFactory = aimTimerIntervalViewModelFactory; }
public LoginViewModel( IMvxNavigationService navigationService, IStorageHelper storageHelper, ILoginService loginService, IChallengeService challengeService, IMessagingCenter messagingCenter, IPopupNavigationService popupNavigationService ) { _navigationService = navigationService; _storageHelper = storageHelper; _loginService = loginService; _challengeService = challengeService; _messagingCenter = messagingCenter; _popupNavigationService = popupNavigationService; LoginCommand = new MvxAsyncCommand(LoginAsync); ForgotPasswordCommand = new MvxAsyncCommand(ForgotPassword); InstagramCommand = new MvxAsyncCommand(RedirectInstagram); FacebookCommand = new MvxAsyncCommand(RedirectFacebook); RegisterCommand = new MvxAsyncCommand(RedirectRegister); }
public RandomWorkerObserver() { MessagingCenter = Xamarin.Forms.MessagingCenter.Instance; }
public MyOrdersViewModel(IOrderService orderSvc, ICache <Models.Order> orderCache, ICache <PropertyModel> propertyCache, ICache <ImageModel> imageCache, ILogger <MyOrdersViewModel> logger, ICacheRefresher cacheRefresher, IOrderValidationService validator, IPageFactory pageFactory, ICurrentUserService userService, LaunchedFromPushModel pushModel, MainThreadNavigator nav, IMessagingCenter messagingCenter, Action <Action> uiInvoke, Action <BaseNavPageType> baseNavAction) { _orderService = orderSvc; _orderCache = orderCache; _propertyCache = propertyCache; _imageCache = imageCache; _logger = logger; _uiInvoke = uiInvoke; _cacheRefresher = cacheRefresher; _validationService = validator; _pageFactory = pageFactory; _userService = userService; _messagingCenter = messagingCenter; _nav = nav; _baseNavAction = baseNavAction; ExampleReportCommand = new Command(() => { try { var order = JsonConvert.DeserializeObject <Models.Order>(Examples.ExampleOrder); _imageCache.Put(order.OrderId, new ImageModel() { OrderId = order.OrderId, Image = Convert.FromBase64String(Examples.ExampleImage) }); _propertyCache.Put(order.OrderId, JsonConvert.DeserializeObject <PropertyModel>(Examples.ExampleProperty)); _nav.Push(_pageFactory.GetPage(PageType.OrderDetail, order)); } catch (Exception ex) { _logger.LogError($"An error occurred while trying to open example order.", ex); } }); Action refreshAction = async() => { try { OrderListRefreshing = true; var fresh = await _orderService.GetMemberOrders(_userService.GetLoggedInAccount()?.UserId); _orderCache.Put(fresh.ToDictionary(x => x.OrderId, x => x)); SetListViewSource(fresh.ToList()); OrderListRefreshing = false; } catch (Exception ex) { _logger.LogError($"Failed to refresh order list.", ex); } }; OrderListRefreshCommand = new Command(refreshAction); _messagingCenter.Subscribe <App>(this, "CacheInvalidated", async x => { await this.SetViewState(); }); OnAppearingBehavior = new Command(async() => { if (!_pmEventSubscribed) { _pmEventSubscribed = true; pushModel.PropertyChanged += async(s, e) => { if (!string.IsNullOrWhiteSpace(pushModel.OrderId)) { var order = await _orderService.GetOrder(pushModel.OrderId); _orderCache.Put(order.OrderId, order); _nav.Push(_pageFactory.GetPage(PageType.OrderDetail, order)); } }; } await SetViewState(); }); }
public ComponentWithMessagingDependency(IMessagingCenter messagingCenter) { _messagingCenter = messagingCenter; _messagingCenter.Subscribe <ComponentWithMessagingDependency>(this, "test", dependency => Console.WriteLine("test")); }
public EventAggregator(IMessagingCenter messagingCenter) { this.messagingCenter = messagingCenter; }
public OpenmediavaultUpdatesViewModel(IOmvService sshService, IMessageBoxService messageBoxService, IMessagingCenter messagingCenter) { _sshService = sshService; _messageBoxService = messageBoxService; _messagingCenter = messagingCenter; }
public MainPage() { InitializeComponent(); _messagingCenter = (BindingContext as MainViewModel)?.MessagingCenter; _messagingCenter.Subscribe <MainViewModel>(this, nameof(FileSetActiveMessage), FileSetActive); }
public GameHubService(IMessagingCenter messagingCenter) { _messagingCenter = messagingCenter; ConfigureHub(); }