private void button1_Click(object sender, EventArgs e) { Image image = Tenor.Mobile.Drawing.GraphicsEx.CopyFromScreen(this.CreateGraphics(), new Rectangle(0, 0, this.Width, this.Height)); pictureBox1.Image = image; Icon icon = this.Icon; NotificationWithSoftKeys.Show(Guid.NewGuid(), "test", "text text", true, icon); Tenor.Mobile.Device.Device.HapticBounce(); }
public void ShowNotif(String text) { _notifTexts.Add(text); _notifIndex = 1; if (_softkeyNotification == null) { _softkeyNotification = new NotificationWithSoftKeys(); _softkeyNotification.Icon = Resources.Notif; _softkeyNotification.InitialDuration = 20; _softkeyNotification.Spinners = true; _softkeyNotification.SpinnerClick += new SpinnerClickEventHandler(softkeyNotification_SpinnerClick); _softkeyNotification.LeftSoftKey = new NotificationSoftKey(SoftKeyType.Hide, "Hide"); _softkeyNotification.RightSoftKey = new NotificationSoftKey(SoftKeyType.Dismiss, "Dismiss all"); _softkeyNotification.RightSoftKeyClick += new EventHandler(softkeyNotificationCustom2_RightSoftKeyClick); } _softkeyNotification.Caption = String.Format("Location Scheduler\t{0} of {1}", _notifIndex, _notifTexts.Count); _softkeyNotification.Text = text; _softkeyNotification.Visible = true; }
static void Main(string[] args) { InitNotification(); //Определение нотификаций и событий _notification = new NotificationWithSoftKeys(); _notification.LeftSoftKey = new NotificationSoftKey(SoftKeyType.Hide, Properties.Resources.Program_LeftSoftKey); _notification.RightSoftKey = new NotificationSoftKey(SoftKeyType.Dismiss, Properties.Resources.Program_RightSoftKey); _notification.RightSoftKeyClick += OnNotificationRightSoftKeyClick; //Запуск сервиса и регистрация сообщения для него ServiceApplication.Name = Interprocess.ServiceName; ServiceApplication.RegisterMessage(Interprocess.WM_QUIT_SERVICE); ServiceApplication.RegisterMessage(Interprocess.WM_TIMER_TICK); ServiceApplication.OnRegisteredMessage += ServiceApplication_OnRegisteredMessage; Cache.InitPath(SystemConfiguration.AppInstallPath + "\\Cache"); _baseLogic = new BaseLogic(new DataLogic(), new CommunicationLogic()); //_baseLogic.IDataLogic.ClearNotificationTempDataInCache(); _eventsGetResponsePrev = new EventsGetResponse(); //автовход if (_baseLogic.IDataLogic.GetToken() != "") { try { _baseLogic.AutoLogin(); _eventsGetResponsePrev = _baseLogic.EventsGet(true, false, true); DebugHelper.WriteLogEntry("Notificator AutoLogin success."); /*_eventsGetResponsePrev.CommentsCount = 0; * _eventsGetResponsePrev.FriendsCount = 0; * _eventsGetResponsePrev.MessagesCount = 0;*/ } catch (VKException ex) { CatchErrors(ex); } catch (Exception ex) { DebugHelper.WriteLogEntry(ex, "Unexpected error."); } } else { DebugHelper.WriteLogEntry("Notificator service can't be started, there are no token in registry."); Application.Exit(); } //Устанавливаем время последней проверки _lastCheckedTime = DateTime.Now; //Считываем из реестра значение периода проверки _checkInterval = GetCheckInterval(); //Задаем время, когда необходимо будет разбудить устройство try { WakeupScheduler.ScheduleWakeUp(_lastCheckedTime.AddMilliseconds(_checkInterval)); } catch (ExternalException exception) { DebugHelper.WriteLogEntry(exception, exception.Message); throw; } catch (Exception exception) { DebugHelper.WriteLogEntry(exception, "Error in scheduling wakeup program launch"); throw; } ServiceApplication.Run(); }
private void softkeyNotificationCustom2_RightSoftKeyClick(object sender, EventArgs e) { _notifIndex = 1; _notifTexts.Clear(); _softkeyNotification = null; }