private void ItemHistoryAVCallEvent_ValueLoaded(object sender, EventArgs e)
        {
            this.@event = this.Value;

            this.labelDisplayName.Content = [email protected];
            this.labelDate.Content        = BaseItem <HistoryAVCallEvent> .GetFriendlyDateString([email protected]);

            this.ctxMenu_AddToContacts.IsEnabled = ([email protected] == null);

            TimeSpan duration = [email protected] - [email protected];

            this.labelDuration.Content = string.Format("Duration: {0:D2}:{1:D2}:{2:D2}", duration.Hours, duration.Minutes, duration.Seconds);
            switch (@event.Status)
            {
            case HistoryEvent.StatusType.Incoming:
                this.imageIcon.Source = MyImageConverter.FromBitmap(Properties.Resources.call_incoming_45);
                break;

            case HistoryEvent.StatusType.Outgoing:
                this.imageIcon.Source = MyImageConverter.FromBitmap(Properties.Resources.call_outgoing_45);
                break;

            default:
                this.imageIcon.Source = MyImageConverter.FromBitmap(Properties.Resources.call_missed_45);
                break;
            }

            this.Width = Double.NaN;
        }
Example #2
0
        private void ItemWatcher_ValueLoaded(object sender, EventArgs e)
        {
            this.@event = this.Value;

            this.labelUriString.Content = String.Format(CultureInfo.CurrentUICulture, "{0} ({1})", UriUtils.GetDisplayName([email protected]), [email protected]);
            this.labelPackage.Content   = String.Format(CultureInfo.CurrentUICulture, "Package ({0})", [email protected]);
            this.labelStatus.Content    = String.Format(CultureInfo.CurrentUICulture, "{0} ({1})", ItemWatcher.GetAsString([email protected]), ItemWatcher.GetAsString([email protected]));

            switch ([email protected])
            {
            case watcherStatus.active:
                this.imageStatus.Source      = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_green_16);
                this.ctxMenu_Allow.IsEnabled = false;
                break;

            case watcherStatus.pending:
                this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_yellow_16);
                break;

            case watcherStatus.waiting:
                this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_grey_16);
                break;

            case watcherStatus.terminated:
                this.imageStatus.Source       = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_red_16);
                this.ctxMenu_Allow.IsEnabled  = false;
                this.ctxMenu_Block.IsEnabled  = false;
                this.ctxMenu_Revoke.IsEnabled = false;
                break;
            }
        }
 private void UpdateButtonCallOrAnswer(bool enabled, String text, Bitmap image)
 {
     this.buttonCallOrAnswer.Tag          = text;
     this.buttonCallOrAnswer.IsEnabled    = enabled;
     this.buttonCallOrAnswerLabel.Content = text;
     this.buttonCallOrAnswerImage.Source  = MyImageConverter.FromBitmap(image);
 }
Example #4
0
        private static ImageSource GetPresenceIcon(Contact contact)
        {
            switch (contact.PresenceStatus)
            {
            case BogheCore.PresenceStatus.Away:
                return(MyImageConverter.FromBitmap(Properties.Resources.user_time_16));

            case BogheCore.PresenceStatus.BeRightBack:
                return(MyImageConverter.FromBitmap(Properties.Resources.user_back16));

            case BogheCore.PresenceStatus.Busy:
                return(MyImageConverter.FromBitmap(Properties.Resources.user_busy_16));

            case BogheCore.PresenceStatus.Online:
                return(MyImageConverter.FromBitmap(Properties.Resources.user_16));

            case BogheCore.PresenceStatus.OnThePhone:
                return(MyImageConverter.FromBitmap(Properties.Resources.user_onthephone_16));

            case BogheCore.PresenceStatus.OutToLunch:
            case BogheCore.PresenceStatus.Offline:
            default:
                return(MyImageConverter.FromBitmap(Properties.Resources.user_offline_16));
            }
        }
Example #5
0
 private void buttonSound_Click(object sender, RoutedEventArgs e)
 {
     if (this.AVSession != null)
     {
         this.AVSession.Mute(!this.AVSession.IsMute, twrap_media_type_t.twrap_media_audio);
         this.imageSound.Source = MyImageConverter.FromBitmap(this.AVSession.IsMute ? Properties.Resources.sound_off_16 : Properties.Resources.sound_on_16);
     }
 }
Example #6
0
        private void ItemHistoryFileTransferEvent_ValueLoaded(object sender, EventArgs e)
        {
            this.@event = this.Value;

            this.fileInfo          = String.IsNullOrEmpty([email protected]) ? null : new System.IO.FileInfo([email protected]);
            this.labelInfo.Content = String.Format("{0} - {1}", [email protected], fileInfo != null ? fileInfo.Name : "-");
            this.labelDate.Content = BaseItem <HistoryFileTransferEvent> .GetFriendlyDateString([email protected]);

            this.ctxMenu_AddToContacts.IsEnabled = ([email protected] == null);

            switch ([email protected])
            {
            case HistoryEvent.StatusType.Failed:
            default:
            {
                this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.document_forbidden_16);
                break;
            }

            case HistoryEvent.StatusType.Incoming:
            {
                this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.document_down_16);
                break;
            }

            case HistoryEvent.StatusType.Outgoing:
            {
                this.imageStatus.Source = MyImageConverter.FromBitmap(Properties.Resources.document_up_16);
                break;
            }
            }

            if (this.fileInfo == null || !this.fileInfo.Exists)
            {
                this.imageIcon.Source           = MyImageConverter.FromBitmap(Properties.Resources.document_forbidden_32);
                this.ctxMenu_OpenFile.IsEnabled = false;
            }
            else
            {
                using (System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(this.fileInfo.FullName))
                {
                    this.imageIcon.Source = MyImageConverter.FromIcon(icon);
                }
                this.ctxMenu_OpenFile.IsEnabled = true;
            }

            this.Width = Double.NaN;
        }
        private void UpdateMenuItemAddRemoveVideo(bool enabled)
        {
            this.MenuItemCall_AddRemoveVideo.IsEnabled = enabled;
            if (this.AVSession != null)
            {
                if ((this.AVSession.MediaType & MediaType.Video) == MediaType.Video)
                {
                    this.MenuItemCall_AddRemoveVideo.Header      = Strings.AV_MenuRemoveVideo;
                    this.MenuItemCall_AddRemoveVideoImage.Source = MyImageConverter.FromBitmap(Properties.Resources.video_pause_16);
                }
                else
                {
                    this.MenuItemCall_AddRemoveVideo.Header = Strings.AV_MenuAddVideo;

                    this.MenuItemCall_AddRemoveVideoImage.Source = MyImageConverter.FromBitmap(Properties.Resources.video_play_16);
                }
            }
        }
Example #8
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;

            this.imageAvatar.Source       = MyImageConverter.FromBitmap(Properties.Resources.avatar_48);
            this.labelFreeText.Content    = this.configurationService.Get(Configuration.ConfFolder.RCS, Configuration.ConfEntry.FREE_TEXT, Configuration.DEFAULT_RCS_FREE_TEXT);
            this.labelDisplayName.Content = this.configurationService.Get(Configuration.ConfFolder.IDENTITY, Configuration.ConfEntry.DISPLAY_NAME, Configuration.DEFAULT_IDENTITY_DISPLAY_NAME);

            if (System.IO.File.Exists(MainWindow.AVATAR_PATH))
            {
                this.imageAvatar.Source = new ImageSourceConverter().ConvertFromInvariantString(MainWindow.AVATAR_PATH) as ImageSource;
            }


            Status[] statues = new Status[]
            {
                new Status("Online", PresenceStatus.Online, "/BogheApp;component/embedded/16/user_16.png"),
                new Status("Busy", PresenceStatus.Busy, "/BogheApp;component/embedded/16/user_busy_16.png"),
                new Status("Be Right Back", PresenceStatus.BeRightBack, "/BogheApp;component/embedded/16/user_back16.png"),
                new Status("Away", PresenceStatus.Away, "/BogheApp;component/embedded/16/user_time_16.png"),
                new Status("On The Phone", PresenceStatus.OnThePhone, "/BogheApp;component/embedded/16/user_onthephone_16.png"),
                new Status("HyperAvailable", PresenceStatus.HyperAvailable, "/BogheApp;component/embedded/16/user_hyper_avail_16.png"),
                new Status("Offline", PresenceStatus.Offline, "/BogheApp;component/embedded/16/user_offline_16.png")
            };
            PresenceStatus status = (PresenceStatus)Enum.Parse(typeof(PresenceStatus),
                                                               this.configurationService.Get(Configuration.ConfFolder.RCS, Configuration.ConfEntry.STATUS, Configuration.DEFAULT_RCS_STATUS.ToString()));
            int statusIndex = statues.ToList().FindIndex(x => x.Value == status);

            this.comboBoxStatus.ItemsSource   = statues;
            this.comboBoxStatus.SelectedIndex = statusIndex >= 0 ? statusIndex : 6;


            this.registrations.CollectionChanged += (_sender, _e) =>
            {
                this.MenuItemFile_Registrations.Header = String.Format("Registrations ({0})", this.registrations.Count);
            };
            this.watchers.CollectionChanged += (_sender, _e) =>
            {
                this.MenuItemEAB_Authorizations.Header = String.Format("Authorizations ({0})", this.watchers.Count);
            };

            this.Cursor = Cursors.Arrow;
        }
Example #9
0
        private void xcapService_onXcapEvent(object sender, XcapEventArgs e)
        {
            if (e.Type != XcapEventTypes.PRESCONTENT_DONE)
            {
                return;
            }

            if (this.Dispatcher.Thread != System.Threading.Thread.CurrentThread)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new EventHandler <XcapEventArgs>(this.xcapService_onXcapEvent), sender, new object[] { e });
                return;
            }

            switch (e.Type)
            {
            case XcapEventTypes.PRESCONTENT_DONE:
            {
                System.Drawing.Image avatar;
                object content = e.GetExtra(XcapEventArgs.EXTRA_CONTENT);
                if (content != null && content is String)
                {
                    try
                    {
                        using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(content as String)))
                        {
                            avatar = System.Drawing.Bitmap.FromStream(stream);
                            this.imageAvatar.Source = MyImageConverter.FromBitmap(avatar as System.Drawing.Bitmap);
                        }
                    }
                    catch (Exception ex)
                    {
                        LOG.Error("Failed to get avatar", ex);
                    }
                }
                break;
            }

            default:
                break;
            }
        }
Example #10
0
 private bool SetAvatarFromBase64String(String b64)
 {
     System.Drawing.Image avatar;
     if (!String.IsNullOrEmpty(b64))
     {
         try
         {
             using (MemoryStream stream = new MemoryStream(Convert.FromBase64String(b64)))
             {
                 avatar = System.Drawing.Bitmap.FromStream(stream);
                 this.imageAvatar.Source = MyImageConverter.FromBitmap(avatar as System.Drawing.Bitmap);
                 return(true);
             }
         }
         catch (Exception ex)
         {
             LOG.Error("Failed to get avatar", ex);
         }
     }
     return(false);
 }
        private void sipService_onRegistrationEvent(object sender, RegistrationEventArgs e)
        {
            if (this.Dispatcher.Thread != Thread.CurrentThread)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new EventHandler <RegistrationEventArgs>(this.sipService_onRegistrationEvent), sender, new object[] { e });
                return;
            }

            switch (e.Type)
            {
            case RegistrationEventTypes.REGISTRATION_INPROGRESS:
                this.screenService.SetProgressInfo("Trying to Sign In...");

                // indicators
                this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_grey_24);
                break;

            case RegistrationEventTypes.REGISTRATION_NOK:
                this.screenService.SetProgressInfo(e.Phrase);
                break;

            case RegistrationEventTypes.REGISTRATION_OK:
                this.screenService.SetProgressInfo("Signed In");

                // Screens
                this.screenService.Hide(ScreenType.Authentication);
                this.screenService.Show(ScreenType.History, 1);
                this.screenService.Show(ScreenType.Contacts, 0);

                // Menus
                this.MenuItemFile_SignIn.IsEnabled        = false;
                this.MenuItemFile_SignOut.IsEnabled       = true;
                this.MenuItemFile_Registrations.IsEnabled = true;
                this.MenuItemEAB.IsEnabled     = true;
                this.MenuItemHistory.IsEnabled = true;

                // indicators
                this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_green_24);

                // Sound alert
                this.soundService.PlayConnectionChanged(true);

                break;

            case RegistrationEventTypes.UNREGISTRATION_INPROGRESS:
                this.screenService.SetProgressInfo("Trying to Sign Out...");

                // indicators
                this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_grey_24);
                break;

            case RegistrationEventTypes.UNREGISTRATION_NOK:
                this.screenService.SetProgressInfo(e.Phrase);
                break;

            case RegistrationEventTypes.UNREGISTRATION_OK:
                this.screenService.SetProgressInfo("Signed Out");

                // Screens
                //new Thread(delegate()
                //{
                this.screenService.HideAllExcept(ScreenType.Options | ScreenType.Authorizations);
                this.screenService.Show(ScreenType.Authentication, 0);
                //}).Start();

                // Menus
                this.MenuItemFile_SignIn.IsEnabled        = true;
                this.MenuItemFile_SignOut.IsEnabled       = false;
                this.MenuItemFile_Registrations.IsEnabled = false;
                this.MenuItemEAB.IsEnabled     = false;
                this.MenuItemHistory.IsEnabled = false;

                //...
                this.registrations.Clear();
                this.watchers.Clear();

                // indicators
                this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_red_24);

                // Sound alert
                this.soundService.PlayConnectionChanged(false);
                break;
            }
        }
        private void sipService_onRegistrationEvent(object sender, RegistrationEventArgs e)
        {
            if (this.Dispatcher.Thread != Thread.CurrentThread)
            {
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal,
                                            new EventHandler <RegistrationEventArgs>(this.sipService_onRegistrationEvent), sender, new object[] { e });
                return;
            }

            switch (e.Type)
            {
            //case RegistrationEventTypes.REGISTRATION_INPROGRESS:
            //    this.screenService.SetProgressInfo("正在登陆服务器,请稍后...");

            //    // indicators
            //    this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_grey_24);
            //    break;

            case RegistrationEventTypes.REGISTRATION_NOK:
                this.screenService.SetProgressInfo(e.Phrase);
                break;

            // for test
            case RegistrationEventTypes.REGISTRATION_INPROGRESS:
            case RegistrationEventTypes.UNREGISTRATION_OK:
            case RegistrationEventTypes.REGISTRATION_OK:
                this.screenService.SetProgressInfo("Signed In");

                // Screens
                this.screenService.Hide(ScreenType.Authentication);
                this.screenService.Show(ScreenType.Contacts, 1);
                this.screenService.Show(ScreenType.History, 2);
                this.screenService.Show(ScreenType.PersonalCenter, 3);
                this.screenService.Show(ScreenType.Call, 0);

                // Menus
                this.MenuItemFile_SignIn.IsEnabled  = false;
                this.MenuItemFile_SignOut.IsEnabled = true;
                //this.MenuItemFile_Registrations.IsEnabled = true;
                this.MenuItemEAB.IsEnabled     = true;
                this.MenuItemHistory.IsEnabled = true;

                // indicators
                this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_green_24);

                // Sound alert
                // this.soundService.PlayConnectionChanged(true);

                break;

            case RegistrationEventTypes.UNREGISTRATION_INPROGRESS:
                this.screenService.SetProgressInfo("正在退出服务器,请稍后....");

                // indicators
                this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_grey_24);
                break;

            case RegistrationEventTypes.UNREGISTRATION_NOK:
                this.screenService.SetProgressInfo(e.Phrase);
                break;

                //case RegistrationEventTypes.UNREGISTRATION_OK:
                //    this.screenService.SetProgressInfo("Signed Out");
                //    this.screenService.SetProgressInfo("登录失败:请输入正确的用户名和密码");

                //    // Screens
                //    if (this.sipService.SipStack.State == MySipStack.STACK_STATE.STOPPED)
                //    {
                //        this.screenService.HideAllExcept(ScreenType.Options | ScreenType.Authorizations);
                //        this.screenService.Show(ScreenType.Authentication, 0);
                //    }

                //    // Menus
                //    this.MenuItemFile_SignIn.IsEnabled = true;
                //    this.MenuItemFile_SignOut.IsEnabled = false;
                //   // this.MenuItemFile_Registrations.IsEnabled = false;
                //    this.MenuItemEAB.IsEnabled = false;
                //    this.MenuItemHistory.IsEnabled = false;

                //    //...
                //    this.registrations.Clear();
                //    this.watchers.Clear();

                //    // indicators
                //    this.imageIndicatorConn.Source = MyImageConverter.FromBitmap(Properties.Resources.bullet_ball_glass_red_24);

                //    // Sound alert
                //    // this.soundService.PlayConnectionChanged(false);
                //    break;
            }
        }