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 #2
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));
            }
        }
        void Client_GetDiamondShoppingItemDetailImageBufferCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <byte[][]> e)
        {
            try
            {
                App.BusyToken.CloseBusyWindow();
                if (e.Error != null)
                {
                    MyMessageBox.ShowInfo("加载钻石商品详细信息失败。原因为:" + e.Error.Message);
                    return;
                }

                ListDetailImages.Clear();
                ListDetailImageBuffers.Clear();
                if (e.Result != null)
                {
                    foreach (var item in e.Result)
                    {
                        ListDetailImageBuffers.Add(item);
                        ListDetailImages.Add(MyImageConverter.GetIconSource(item));
                    }
                }

                this.IsEnabled = true;
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("加载钻石商品详细信息异常。原因为:" + exc.Message);
            }
        }
        private void btnAddDetailImage_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog openDig = new OpenFileDialog();
                if (openDig.ShowDialog() == true)
                {
                    string imgName = Guid.NewGuid().ToString();
                    byte[] buffer  = null;
                    using (FileStream stream = new FileStream(openDig.FileName, FileMode.Open))
                    {
                        buffer = new byte[stream.Length];
                        stream.Read(buffer, 0, (int)stream.Length);
                    }

                    this.ListDetailImageNames.Add(imgName);
                    this.ListDetailImageBuffers.Add(buffer);
                    this.ListDetailImages.Add(MyImageConverter.GetIconSource(buffer));
                }
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo(exc.Message);
            }
        }
Example #5
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 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 #7
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 #8
0
        public static string ConvertImageFile(string strInputFile, string strOutputType, int iResizeWidth, int iResizeHeight, double iPDFScale, int iPDFStartPage, int iPDFEndPage)
        {
            MyImageConverter obj = new MyImageConverter();

            string strinputpath1 = HttpContext.Current.Server.MapPath("~/uploads/" + strInputFile);

            string strSmallImagePath = HttpContext.Current.Server.MapPath("~/smallimage/");

            string strBigImagePath = HttpContext.Current.Server.MapPath("~/bigimage/");

            //clear the files in smallimage folder
            System.IO.DirectoryInfo di = new DirectoryInfo(strSmallImagePath);

            foreach (FileInfo file in di.GetFiles())
            {
                file.Delete();
            }

            //clear the files in bigimage folder
            System.IO.DirectoryInfo di2 = new DirectoryInfo(strBigImagePath);

            foreach (FileInfo file in di2.GetFiles())
            {
                file.Delete();
            }


            int  iTotalPage = obj.GetTotalPages(strinputpath1);
            bool bResult    = true;

            for (int i = 1; i <= iTotalPage; i++)
            {
                string strThumbnailFileName = strSmallImagePath + "thumbnail" + i.ToString() + ".jpg";

                string strBigFileName = strBigImagePath + i.ToString() + ".jpg";

                //if input file is pdf, set to specific page for export
                obj.PDFStartPage = i;
                obj.PDFEndPage   = i;
                obj.PDFScale     = iPDFScale;
                /// output thumbnail images
                bResult = obj.ConvertToImage(strinputpath1, strThumbnailFileName, 390, 518, i);
                /// output big images
                bResult = obj.ConvertToImage(strinputpath1, strBigFileName, i);
            }


            if (bResult)
            {
                return("Convert Completed");
            }
            else
            {
                return("Convert Image Failed");
            }
        }
Example #9
0
        private void ItemFileTransfer_ValueLoaded(object sender, EventArgs e)
        {
            this.@event = this.Value;
            if (this.@event == null)
            {
                LOG.Error("Event is null");
                return;
            }

            if ([email protected] == null)
            {
                LOG.Error("No MSRP session associated to this event");
                return;
            }

            [email protected] += this.MsrpSession_onMsrpEvent;

            switch ([email protected])
            {
            case HistoryEvent.StatusType.Incoming:
                this.labelDescription.Content = String.Format("Receiving from {0}...", UriUtils.GetDisplayName([email protected]));
                this.buttonAccept.Content     = "accept";
                this.buttonDecline.Content    = "decline";
                this.gradientStop.Color       = Colors.Bisque;
                break;

            case HistoryEvent.StatusType.Outgoing:
                this.labelDescription.Content = "Sending...";
                this.buttonAccept.Visibility  = Visibility.Collapsed;
                this.buttonDecline.Content    = "abort";
                this.gradientStop.Color       = Colors.SkyBlue;
                break;

            case HistoryEvent.StatusType.Failed:
            default:
                this.gradientStop.Color = Colors.Red;
                break;
            }

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

            this.fileName           = new FileInfo([email protected]).Name;
            this.textBlockName.Text = this.fileName;
            if (File.Exists([email protected]))
            {
                using (System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon([email protected]))
                {
                    this.imageIcon.Source = MyImageConverter.FromIcon(icon);
                }
            }
        }
Example #10
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 #12
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 #13
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;
            }
        }
        private void btnUploadIcon_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                OpenFileDialog openDig = new OpenFileDialog();
                if (openDig.ShowDialog() == true)
                {
                    using (FileStream stream = new FileStream(openDig.FileName, FileMode.Open))
                    {
                        _iconBuffer = new byte[stream.Length];
                        stream.Read(_iconBuffer, 0, (int)stream.Length);
                    }

                    this.imgIcon.Source = MyImageConverter.GetIconSource(_iconBuffer);
                }
            }
            catch (Exception exc)
            {
            }
        }
Example #15
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);
 }
Example #16
0
        private void avatar_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog();
            fileDialog.Multiselect = false;
            Nullable <bool> result = fileDialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                if (this.sipService.IsRegistered && this.sipService.IsXcapEnabled)
                {
                    LOG.Debug("Saving avatar(remote)...");
                    String mimeType  = null;
                    String avatarB64 = this.GetAvatarBase64FromFilePath(fileDialog.FileName, out mimeType);
                    if (!String.IsNullOrEmpty(avatarB64))
                    {
                        // ImageSource will be updated when xcapcallback is received
                        this.xcapService.AvatarPublish(avatarB64, mimeType);
                    }
                }
                else
                {
                    LOG.Debug("Saving avatar(local)...");
                    System.Drawing.Imaging.ImageFormat rawFormat;
                    System.Drawing.Image avatar = this.GetAvatarFromFilePath(fileDialog.FileName, out rawFormat);
                    if (avatar != null)
                    {
                        try
                        {
                            avatar.Save(MainWindow.AVATAR_PATH);
                            this.imageAvatar.Source = MyImageConverter.FromImage(avatar);
                            EventHandlerTrigger.TriggerEvent(this.onAvatarChanded, this, new StringEventArgs(MainWindow.AVATAR_PATH));
                        }
                        catch (Exception ex)
                        {
                            LOG.Error(ex);
                        }
                    }
                }
            }
        }
        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;
            }
        }
 public void SetIcon(byte[] buffer)
 {
     this._parentObject.IconBuffer = buffer;
     this._icon = MyImageConverter.GetIconSource(buffer);
 }
        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;
            }
        }
Example #20
0
 void ItemRunningApp_ValueLoaded(object sender, EventArgs e)
 {
     labelDescription.Text       = this.Value.Description;
     imageIcon.Source            = MyImageConverter.FromImage(this.Value.Icon);
     labelDescription.FontWeight = (this.Value.hWnd == IntPtr.Zero) ? FontWeights.Bold : FontWeights.Normal;
 }
Example #21
0
        private void sipService_onInviteEvent(object sender, InviteEventArgs e)
        {
            if (this.@event == null || [email protected] == null)
            {
                return;
            }

            if (e.SessionId != [email protected])
            {
                return;
            }

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

            switch (e.Type)
            {
            case InviteEventTypes.CONNECTED:
            {
                if (this.imageIcon.Source == null && File.Exists([email protected]))
                {
                    using (System.Drawing.Icon icon = System.Drawing.Icon.ExtractAssociatedIcon([email protected]))
                    {
                        this.imageIcon.Source = MyImageConverter.FromIcon(icon);
                    }
                }
                this.buttonAccept.Visibility  = Visibility.Collapsed;
                this.buttonDecline.Visibility = Visibility.Visible;
                this.buttonDecline.Content    = "abort";
                break;
            }

            case InviteEventTypes.DISCONNECTED:
            {
                if (!this.done)
                {
                    this.buttonAccept.Visibility  = Visibility.Collapsed;
                    this.buttonDecline.Visibility = Visibility.Collapsed;
                    this.progressBar.Visibility   = Visibility.Collapsed;

                    this.labelDescription.Content = String.Format("File transfer Failed ({0})", e.Phrase);
                    this.gradientStop.Color       = Colors.Red;

                    this.imageIcon.Cursor = Cursors.No;
                }
                else
                {
                    this.imageIcon.Cursor = Cursors.Hand;
                    this.imageIcon.Tag    = [email protected];
                }

                this.sipService.onInviteEvent -= this.sipService_onInviteEvent;
                break;
            }

            default:
                break;
            }
        }