public void AddEventNotification(EventNotification eventNotification) { if (eventNotifications.ContainsKey(eventNotification.Event)) { eventNotifications.Remove(eventNotification.Event); } eventNotifications.Add(eventNotification.Event, eventNotification); }
public void RaiseEvent(ClientEvent clientEvent) { try { if (eventNotifications[clientEvent] != null) { EventNotification eventNotification = (EventNotification)eventNotifications[clientEvent]; switch (eventNotification.NotificationType) { case EventNotificationType.Sound: PlayAudioFile(eventNotification.NotificationData); break; case EventNotificationType.Flash: break; case EventNotificationType.None: break; case EventNotificationType.RingingStart: PlayRingTone(eventNotification.NotificationData); break; case EventNotificationType.RingingStop: StopPlayingRingTone(); break; default: break; } } } catch (Exception ex) { #if (TRACE) Console.WriteLine("RaiseEvent Exception : " + ex.Message); #endif } }
public ClientForm() { RegistryKey key = Registry.LocalMachine.OpenSubKey(mCultureInfoRegistryKey); if (key!=null) { try { String value = key.GetValue("CultureInfo", "").ToString(); if (value.Length == 5) { CultureInfo currentCulture = new CultureInfo(value); Thread.CurrentThread.CurrentUICulture = currentCulture; } } catch (Exception) { } key.Close(); } //INITIALIZE STORAGE VERISIONING List<StorageDDL> storageDDL = new List<StorageDDL>(); storageDDL.Add(new StorageDDL("1.0.0", Properties.Resources.fbDDL_1_0_0)); storageDDL.Add(new StorageDDL("1.0.1", Properties.Resources.fbDDL_1_0_1)); storageDDL.Add(new StorageDDL("1.0.2", Properties.Resources.fbDDL_1_0_2)); storageDDL.Add(new StorageDDL("1.0.3", Properties.Resources.fbDDL_1_0_3)); myStorage = new Storage(storageDDL, "1.0.3"); InitializeComponent(); LocalizeComponent(); PRESENCES = new String[] { Properties.Localization.txtStatusOffline, Properties.Localization.txtStatusOnline, Properties.Localization.txtStatusAway, Properties.Localization.txtStatusExtendedAway, Properties.Localization.txtStatusDND }; // Add the handlers to the NetworkChange events. NetworkChange.NetworkAvailabilityChanged += NetworkAvailabilityChanged; NetworkChange.NetworkAddressChanged += NetworkAddressChanged; // initialize phone lines states mySIPPhoneLines = new PhoneLineState[4]; mySIPPhoneLines[0] = new PhoneLineState(); mySIPPhoneLines[1] = new PhoneLineState(); mySIPPhoneLines[2] = new PhoneLineState(); mySIPPhoneLines[3] = new PhoneLineState(); //initialize client events EventNotification eventNotificationIncomingInstantMessage = new EventNotification(); eventNotificationIncomingInstantMessage.Event = ClientEvent.IncomingInstantMessage; eventNotificationIncomingInstantMessage.NotificationData = Directory.GetCurrentDirectory() + @"\Sounds\im.mp3"; eventNotificationIncomingInstantMessage.NotificationType = EventNotificationType.Sound; myClientEvents.AddEventNotification(eventNotificationIncomingInstantMessage); EventNotification eventNotificationIncomingNudge = new EventNotification(); eventNotificationIncomingNudge.Event = ClientEvent.IncomingNudge; eventNotificationIncomingNudge.NotificationData = Directory.GetCurrentDirectory() + @"\Sounds\nudge.mp3"; eventNotificationIncomingNudge.NotificationType = EventNotificationType.Sound; myClientEvents.AddEventNotification(eventNotificationIncomingNudge); //Make Sure that AppDataDir directory exists // try { if (!Directory.Exists(AppDataDir)) Directory.CreateDirectory(AppDataDir); } catch (Exception ex) { #if (TRACE) Console.WriteLine("ClientForm AppDataDir : " + ex.Message); #endif } //set border and background colors //open login panel and process login myMainWindowSplitContainer.Panel1Collapsed = false; myMainWindowSplitContainer.Panel2Collapsed = true; //Media Engine Callback myMediaEngineCallback = new ClientCallBack(this.Callback); //link Presence Images myRosterListTreeView.ImageList = this.myPresenceImagesList; //select Default Phone Line Tab myPhoneLinesTabControl.SelectedTab = myPhoneLine0Tab; myDialPadTabControl.SelectedTab = myTabItemDialPad; //preset size this.ClientSize = myClientSize; this.MinimumSize = this.Size; this.MaximumSize = this.Size; this.MaximizeBox = false; bool result = RegisterHotKey(this.Handle, this.GetType().GetHashCode(), 1, 0); myVideoPlugin.VideoPluginExit += new EventHandler(myVideoPlugin_VideoPluginExit); initializeDialPadMenuItems(); //Initialize mXMPPIQ mXMPPIQ = new XMPPIQ(ConfigIM.IMServer); mXMPPIQ.SendIQMessage += new EventHandler(mXMPPIQ_SendIQMessage); }
public void AddEventNotification(EventNotification eventNotification) { if (eventNotifications.ContainsKey(eventNotification.Event)) eventNotifications.Remove(eventNotification.Event); eventNotifications.Add(eventNotification.Event, eventNotification); }