Inheritance: System.EventArgs
Ejemplo n.º 1
0
        private void OnVideoMailCountChanged(MWIEventArgs args)
        {
            if (ServiceManager.Instance.Dispatcher.Thread != Thread.CurrentThread)
            {
                ServiceManager.Instance.Dispatcher.BeginInvoke((Action)(() => this.OnVideoMailCountChanged(args)));
                return;
            }

            if (App.CurrentAccount != null)
            {
                if (args != null) 
                    App.CurrentAccount.VideoMailCount += args.MwiCount;
                UpdateVideomailCount();
                ServiceManager.Instance.AccountService.Save();
            }
        }
Ejemplo n.º 2
0
		private void OnNotifyEventReceived(IntPtr lc, IntPtr eventPtr, string notified_event, IntPtr bodyPtr)
		{
			if (linphoneCore == IntPtr.Zero) return;

		    if (bodyPtr != IntPtr.Zero)
		    {
		        IntPtr subTypePtr = LinphoneAPI.linphone_content_get_buffer(bodyPtr);
		        if (subTypePtr != IntPtr.Zero)
		        {
		            var content = LinphoneAPI.PtrToStringUtf8(subTypePtr);

		            var lines = content.Split(new[] {'\r', '\n'});
		            bool waiting = false;
		            int unreadCount = 0;
		            bool notify = false;
                    foreach (var line in lines)
		            {
		                if (line.StartsWith("Messages-Waiting: "))
		                {
		                    waiting = line.Substring("Messages-Waiting: ".Length).ToLower() == "yes";
		                    notify = true;
		                }
                        else if (line.StartsWith("Voicemail: "))
		                {
		                    try
		                    {
		                        int pos = line.IndexOf(@"/");
		                        if (pos != -1)
		                        {
		                            var len = "Voicemail: ".Length;
		                            unreadCount = Convert.ToInt32(line.Substring(len, pos - len));
                                    notify = true;
		                        }
		                    }
		                    catch (Exception)
		                    {
		                        
		                    }
		                }
		            }

		            if (OnMWIReceivedEvent != null && notify)
		            {
                        var args = new MWIEventArgs(unreadCount, waiting);
		                OnMWIReceivedEvent(args);
		            }
		            return;
		        }
		    }

		    if (NotifyReceivedEvent != null)
				NotifyReceivedEvent(notified_event);
		}
Ejemplo n.º 3
0
        private void OnVideoMailCountChanged(MWIEventArgs args)
        {
            if (ServiceManager.Instance.Dispatcher.Thread != Thread.CurrentThread)
            {
                ServiceManager.Instance.Dispatcher.BeginInvoke((Action)(() => this.OnVideoMailCountChanged(args)));
                return;
            }

            if (App.CurrentAccount != null)
            {
                bool showMWI = false;
                if (args != null)
                {
                    App.CurrentAccount.VideoMailCount = args.MwiCount;
                    showMWI = args.MessageWaiting;
                }
                UpdateVideomailCount(showMWI);
                ServiceManager.Instance.AccountService.Save();
            }
        }