protected override void OnEnabling(EnablingEventArgs e) { devices = null; auxDevices = null; newDevices = null; timer = new Timer(); timer.Interval = 100; timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); try { bluetoothClient = new BluetoothClient(); auxDevices = new List <BluetoothDeviceInfo>(); timer.Start(); } catch (Exception ex) { // If the bluetooth capability is not available for this computer the event will not be enabled and an error message will be shown. ErrorLog.AddError(ErrorType.Failure, Strings.BT_NoBluetooth); Logger.Write(ex); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { InsteonAddress address; if (!InsteonAddress.TryParse(data.Device, out address)) { ErrorLog.AddError(ErrorType.Failure, string.Format("Invalid INSTEON address '{0}'", data.Device)); e.Cancel = true; return; } InsteonService.StartNetwork(); /* if (!InsteonService.VerifyConnection()) { ErrorLog.AddError(ErrorType.Failure, string.Format("Lost connection to INSTEON network. {0}", InsteonService.SpecificConnection != null ? InsteonService.SpecificConnection.ToString() : string.Empty)); e.Cancel = true; return; } */ if (!InsteonService.Network.Devices.ContainsKey(address)) device = InsteonService.Network.Devices.Add(address, new InsteonIdentity()); else device = InsteonService.Network.Devices.Find(address); device.DeviceStatusChanged += device_DeviceStatusChanged; }
protected override void OnEnabling(EnablingEventArgs e) { timer = new Timer(); timer.Interval = 100; // Setting the timer to 0.1 seconds so that it will get the initial list right away. timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); isVisible = false; wasVisible = false; isFirstRun = true; deviceAddress = null; try { bluetoothClient = new BluetoothClient(); timer.Start(); } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, Strings.BT_NoBluetooth); Logger.Write(ex); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { isFirstTime = true; try { apiHelper = new GooglePlusAPIHelper(profileId, Strings.GooglePlus_ApiKey); // Trying to get the current user information in order to see if the entered profileId exists. apiHelper.GetPerson(); } catch (WebException ex) { ErrorLog.AddError(ErrorType.Failure, string.Format(Strings.General_Incorrect, Strings.General_ProfileID)); Logger.Write(ex); e.Cancel = true; return; } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, Strings.GooglePlus_EventCouldntBeEnabled); Logger.Write(ex); e.Cancel = true; return; } }
protected override void OnEnabling(EnablingEventArgs e) { TestAndSetRaiseEvent(); pollingTimer.Interval = TimeSpan.FromSeconds(3); pollingTimer.Tick += new EventHandler(ConditionCheck); pollingTimer.Start(); }
protected override void OnEnabling(EnablingEventArgs e) { // Update our interval with the current values SetInterval(); timer.Start(); }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); if (!e.Cancel) { try { foreach (Video entry in currentVideoList) { if (lastVideoAddedTimestamp.CompareTo(entry.YouTubeEntry.Published) < 0) { lastVideoAddedTimestamp = entry.YouTubeEntry.Published; } } StartTimer(int.Parse(Strings.General_TimeInterval)); } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, string.Format(Strings.GooglePlus_ErrorMonitoringYouTubeUploadedVideos, username)); Logger.Write(ex); e.Cancel = true; return; } } }
protected override void OnEnabling(EnablingEventArgs e) { baseUrl = "http://gdata.youtube.com/feeds/api/videos/"; lastCommentAddedTimestamp = DateTime.MinValue; // We need to check if the video exists. try { InitializeYoutubeConnection(); Uri videoEntryUrl = new Uri(baseUrl + videoID); video = request.Retrieve <Video>(videoEntryUrl); } catch (GDataRequestException ex) { ErrorLog.AddError(ErrorType.Failure, Strings.YouTubeVideoDoesntExists); Logger.Write(ex); e.Cancel = true; return; } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, Strings.YouTube_ErrorMonitoringComment); Logger.Write(ex); e.Cancel = true; return; } isFirstTime = true; StartTimer(100); }
protected override void OnEnabling(EnablingEventArgs e) { lastVideoAddedTimestamp = DateTime.MinValue; try { InitializeYoutubeConnection(); feedUri = new Uri("http://gdata.youtube.com/feeds/api/users/" + username + "/uploads"); videoFeed = request.Get <Video>(feedUri); currentVideoList = videoFeed.Entries.ToList(); } catch (GDataRequestException ex) { ErrorLog.AddError(ErrorType.Failure, string.Format(Strings.General_Incorrect, Strings.General_ProfileID)); Logger.Write(ex); e.Cancel = true; return; } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, string.Format(Strings.GooglePlus_ErrorMonitoringYouTubeUploadedVideos, username)); Logger.Write(ex); e.Cancel = true; return; } }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); if (!e.Cancel) { ThreadPool.QueueUserWorkItem(o => { try { bool found = false; string saveTokenActivities = string.Empty; GPlusActivities activities = apiHelper.ListActivities(); do { saveTokenActivities = activities.nextPageToken; foreach (GPlusActivity activity in activities.items) { if (activity.url.Equals(activityLink)) { activityId = activity.id; found = true; break; } } if (found) { break; } activities = apiHelper.ListActivities(activities.nextPageToken); } while (!string.IsNullOrEmpty(saveTokenActivities)); if (found) { StartTimer(100); } else { ErrorLog.AddError(ErrorType.Failure, string.Format(Strings.General_Incorrect, Strings.General_ActivityID)); e.Cancel = true; } } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, Strings.GooglePlus_EventCouldntBeEnabled); Logger.Write(ex); e.Cancel = true; return; } }); } }
protected override void OnEnabling(EnablingEventArgs e) { if (!Utilities.ConnectedToInternet()) { ErrorLog.AddError(ErrorType.Warning, Strings.Internet_NotConnected); } timer.Start(); }
protected override void OnEnabling(EnablingEventArgs e) { if (!Directory.Exists(fileName)) { ErrorLog.AddError(ErrorType.Failure, Strings.General_DirectoryNotFound); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { if (!File.Exists(FileName)) { ErrorLog.AddError(ErrorType.Failure, Strings.RunProgram_FileNotFound); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { m = new MPlayer(); if (!File.Exists(SoundPath)) { ErrorLog.AddError(ErrorType.Warning, Strings.PlaySound_FileNotFound); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); if (!e.Cancel) { skype.CallStatus += callStatusEventHandler; } }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); if (!e.Cancel) { skype.MessageStatus += new SKYPE4COMLib._ISkypeEvents_MessageStatusEventHandler(Skype_MessageStatus); } }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); if (!e.Cancel) { StartTimer(int.Parse(Strings.General_TimeInterval)); } }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); if (!e.Cancel) { skype.SmsMessageStatusChanged += smsMessageStatusChangedEventHandler; } }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); if (!e.Cancel) { StartTimer(100); } }
protected override void OnEnabling(EnablingEventArgs e) { Dispatcher.FromThread(mainThread).Invoke((Action)(() => interceptKeys.AddCombinationHandler ( monitorKeysDown, OnKeyCombinationActivated ) )); }
/// <summary> /// Starts the timer, already set to an interval of 1 minute /// when the temperature is reached or passed, trigger event once /// </summary> #region Timer protected override void OnEnabling(EnablingEventArgs e) { if (!Utilities.ConnectedToInternet()) { ErrorLog.AddError(ErrorType.Warning, String.Format(Strings.Internet_NotConnected, "Weather")); } // when turned off then off again, will check for passing weather point hasPassed = false; timer.Start(); }
protected override void OnEnabling(EnablingEventArgs e) { if (!e.WasConfiguring && !IsEnabled) { phoneLayout.EnableButton(button.Id); isCreatingForFirstTime = false; phoneConnector.Enable(true); phoneConnector.SetNewData(); phoneConnector.EventCalled += phoneConnector_EventCalled; } }
protected override void OnEnabling(EnablingEventArgs e) { try { outlook = (OOutlook.Application)Marshal.GetActiveObject("Outlook.Application"); outlook.NewMail += mailEvent; } catch { ErrorLog.AddError(ErrorType.Failure, Strings.Outlook_ApplicationNotFound); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { try { this.manager.ConnectPort(this.port, this.settings, this.RecievedData); } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, ex.Message); e.Cancel = true; return; } }
protected override void OnEnabling(EnablingEventArgs e) { try { SpeechRecognitionManager.Recognize(phrase, Recognized); } catch { ErrorLog.AddError(ErrorType.Failure, "Unable to start up the Speech Recognition Engine"); e.Cancel = true; return; } }
protected override void OnEnabling(EnablingEventArgs e) { if (Directory.Exists(folderToMonitor)) { ConfigureFsMonitor(); fileWatcher.EnableRaisingEvents = true; return; } ErrorLog.AddError(ErrorType.Failure, Strings.FolderChange_FolderDoesntExist); e.Cancel = true; }
protected override void OnEnabling(EnablingEventArgs e) { try { SpeechRecognitionManager.Recognize(phrase, Recognized); } catch (InvalidOperationException ex) { ErrorLog.AddError(ErrorType.Failure, ex.Message); e.Cancel = true; return; } }
protected override void OnEnabling(EnablingEventArgs e) { try { this.manager.ConnectPort(this.port, this.settings); } catch { ErrorLog.AddError(ErrorType.Failure, "Unable to open COM port. Ensure port is available or device plugged in."); e.Cancel = true; return; } }
protected override void OnEnabling(EnablingEventArgs e) { try { powerPoint = (OPowerPoint.Application)Marshal.GetActiveObject("PowerPoint.Application"); powerPoint.PresentationPrint += printPresentationEvent; } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, Strings.PowerPoint_ApplicationNotFound); Logger.Write(ex); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { try { excel = (OExcel.Application)Marshal.GetActiveObject("Excel.Application"); excel.WorkbookBeforeClose += closeWorkbookEvent; } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, Strings.Excel_ApplicationNotFound); Logger.Write(ex); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { try { word = (OWord.Application)Marshal.GetActiveObject("Word.Application"); word.DocumentOpen += openDocumentEvent; } catch (Exception ex) { ErrorLog.AddError(ErrorType.Failure, Strings.Word_ApplicationNotFound); Logger.Write(ex); e.Cancel = true; } }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); lock (Lock) { Enabled = true; Done = false; } // Start up the polling thread PollingThread = new Thread(InactivityThread); PollingThread.Start(); }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); lock (Lock) { Done = false; } // Start up the polling thread PollingThread = new Thread(EmailReceiveThread); PollingThread.Start(); }
protected override void OnEnabling(EnablingEventArgs e) { base.OnEnabling(e); }