示例#1
0
 public static void Initialize()
 {
     if (Ok == null)
     {
         Ok                        = CreateRoutedUICommand(@"Ok", typeof(Commands));
         Apply                     = CreateRoutedUICommand(@"Apply", typeof(Commands));
         Cancel                    = CreateRoutedUICommand(@"Cancel", typeof(Commands));
         PhoneDigit                = CreateRoutedUICommand(@"PhoneDigit", typeof(Commands));
         About                     = CreateRoutedUICommand("About", typeof(Commands));
         Homepage                  = CreateRoutedUICommand("Homepage", typeof(Commands));
         Preferences               = CreateRoutedUICommand("Preferences", typeof(Commands));
         Feedback                  = CreateRoutedUICommand("Feedback", typeof(Commands));
         GotoUrl                   = CreateRoutedUICommand("GotoUrl", typeof(Commands));
         GotoEmail                 = CreateRoutedUICommand("GotoEmail", typeof(Commands));
         Login                     = CreateRoutedUICommand("Login", typeof(Commands), CreateGesture(Key.L, ModifierKeys.Control));
         LoginAs                   = CreateRoutedUICommand("LoginAs", typeof(Commands));
         Logout                    = CreateRoutedUICommand("Logout", typeof(Commands));
         Close                     = CreateRoutedUICommand("Close", typeof(Commands));
         UccTracing                = CreateRoutedUICommand("UccTracing", typeof(Commands));
         InvokeTuningWizard        = CreateRoutedUICommand("InvokeTuningWizard", typeof(Commands), CreateGesture(Key.W, ModifierKeys.Control));
         ResetTuningWizardSettings = CreateRoutedUICommand("ResetTuningWizardSettings", typeof(Commands));
         Refresh                   = CreateRoutedUICommand("Refresh", typeof(Commands));
         OpenFolder                = CreateRoutedUICommand("OpenFolder", typeof(Commands));
         View                      = CreateRoutedUICommand("View", typeof(Commands));
         Call                      = CreateRoutedUICommand("Call", typeof(Commands));
         HangUp                    = CreateRoutedUICommand("EndCall", typeof(Commands), CreateGesture(Key.E, ModifierKeys.Control));
         AcceptCall                = CreateRoutedUICommand("AcceptCall", typeof(Commands));
         RejectCall                = CreateRoutedUICommand("RejectCall", typeof(Commands));
         ViewDialpad               = CreateRoutedUICommand("ViewDialpad", typeof(Commands), BaseCommands.CreateGesture(Key.D, ModifierKeys.Control));
         ViewSessionDetails        = CreateRoutedUICommand("ViewSessionDetails", typeof(Commands), CreateGesture(Key.T, ModifierKeys.Control));
         ViewIncomingCalls         = CreateRoutedUICommand("ViewIncomingCalls", typeof(Commands), CreateGesture(Key.I, ModifierKeys.Control));
         ViewLocalVideo            = CreateRoutedUICommand("ViewLocalVideo", typeof(Commands), CreateGesture(Key.M, ModifierKeys.Control));
         CopyAll                   = CreateRoutedUICommand("CopyAll", typeof(Commands));
         Redial                    = CreateRoutedUICommand("Redial", typeof(Commands));
         Remove                    = CreateRoutedUICommand("Remove", typeof(Commands));
         RemoveAll                 = CreateRoutedUICommand("RemoveAll", typeof(Commands));
     }
 }
示例#2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            object result          = null;
            string parameterString = (parameter == null) ? @"" : (parameter as string);

            if (value is AvailabilityValues)
            {
                if (targetType == typeof(ImageSource))
                {
                    try
                    {
                        switch ((AvailabilityValues)value)
                        {
                        //presenceBlock
                        case AvailabilityValues.Online:
                            result = Application.Current.FindResource(@"presenceOnline");
                            break;

                        case AvailabilityValues.Away:
                            result = Application.Current.FindResource(@"presenceAway");
                            break;

                        case AvailabilityValues.BeRightBack:
                        case AvailabilityValues.Idle:
                            result = Application.Current.FindResource("presenceIdleOnline");
                            break;

                        case AvailabilityValues.Busy:
                            result = Application.Current.FindResource("presenceBusy");
                            break;

                        case AvailabilityValues.BusyIdle:
                            result = Application.Current.FindResource("presenceIdleBusy");
                            break;

                        case AvailabilityValues.DoNotDisturb:
                            result = Application.Current.FindResource("presenceDnd");
                            break;

                        case AvailabilityValues.Offline:
                            result = Application.Current.FindResource("presenceOffline");
                            break;

                        case AvailabilityValues.Unknown:
                        default:
                            result = Application.Current.FindResource("presenceOffline");
                            //result = Application.Current.FindResource("presenceUnknown");
                            break;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                else if (targetType == typeof(ControlTemplate))
                {
                    try
                    {
                        switch ((AvailabilityValues)value)
                        {
                        case AvailabilityValues.Online:
                            result = Application.Current.FindResource("GreenBall");
                            break;

                        case AvailabilityValues.Away:
                        case AvailabilityValues.BeRightBack:
                        case AvailabilityValues.Idle:
                            result = Application.Current.FindResource("YellowBall");
                            break;

                        case AvailabilityValues.Busy:
                        case AvailabilityValues.BusyIdle:
                        case AvailabilityValues.DoNotDisturb:
                            result = Application.Current.FindResource("RedBall");
                            break;

                        case AvailabilityValues.Unknown:
                        case AvailabilityValues.Offline:
                        default:
                            result = Application.Current.FindResource("GreyBall");
                            break;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                else                 //if (targetType == typeof(string))
                {
                    switch ((AvailabilityValues)value)
                    {
                    case AvailabilityValues.Online:
                        result = BaseCommands.LoadString(@"Available");
                        break;

                    case AvailabilityValues.Away:
                        result = BaseCommands.LoadString(@"Away");
                        break;

                    case AvailabilityValues.Idle:
                        result = BaseCommands.LoadString(@"Idle");
                        break;

                    case AvailabilityValues.BeRightBack:
                        result = BaseCommands.LoadString(@"BeRightBack");
                        break;

                    case AvailabilityValues.Busy:
                        result = BaseCommands.LoadString(@"Busy");
                        break;

                    case AvailabilityValues.BusyIdle:
                        result = BaseCommands.LoadString(@"BusyAway");
                        break;

                    case AvailabilityValues.DoNotDisturb:
                        result = BaseCommands.LoadString(@"DoNotDisturb");
                        break;

                    case AvailabilityValues.Offline:
                        if (parameterString == @"NoAppearOffline")
                        {
                            goto case AvailabilityValues.Unknown;
                        }
                        result = BaseCommands.LoadString(@"AppearOffline");
                        break;

                    case AvailabilityValues.Unknown:
                    default:
                        result = BaseCommands.LoadString(@"Offline");
                        break;
                    }
                }
            }

            return(result);
        }