/// <summary> /// Происходит при загрузки окна /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { _prevItem = horrizontalMenu.Items[prevpage] as MenuItem; PageHunter.ChangePage(_prevItem); ContexTrayMenu.Show(CurrentUser.Role); new RequestsService(); var role = EmployeeService.UsersCollection.Where(user => user.ID == CurrentUser.ID).First().Type; //Если вошел администратор, то получаем все уведомления с таргетом 0 if (role == Roles.Admin) { this.Title = "Администатор"; notivicationService = new NotificationService(0); Task.Factory.StartNew(() => NotificationService.ClearNotifications(0)); } //Если вошел администратор, то получаем все уведомления с таргетом идентификатор пользователя else if (role == Roles.User) { this.Title = "Пользователь"; notivicationService = new NotificationService(Convert.ToInt32(CurrentUser.ID)); ForUser.RequestsService.GetRequests(CurrentUser.ID); Task.Factory.StartNew(() => NotificationService.ClearNotifications(Convert.ToInt32(CurrentUser.ID))); } else //Если вошел администратор, то получаем все уведомления с таргетом 1 { this.Title = "Технический отдел"; notivicationService = new NotificationService(1); } }
protected override void Handle(CookingCanceledMessage message) { if (Mvx.CanResolve <CookingForegroundServiceConnection>()) { Mvx.Resolve <CookingForegroundServiceConnection>().Binder.Service.Stop(); } notificationService.ClearNotifications(); }
protected override void Handle(MilestonesCreatedMessage message) { notificationService.ClearNotifications(); Task.Factory.StartNew(() => { var service = new Intent(MainActivity.Instance, typeof(CookingForegroundService)); service.PutExtra("milestones", JsonConvert.SerializeObject(message.Milestones)); var conn = new CookingForegroundServiceConnection(); Mvx.RegisterSingleton(conn); MainActivity.Instance.StartService(service); MainActivity.Instance.BindService(service, conn, Bind.AutoCreate); }); }