예제 #1
0
        public void DeactivateKeyboard(KeyboardDescription keyboard)
        {
            CheckDisposed();
#if !MONO
            try
            {
                if (((KeymanKeyboardDescription)keyboard).IsKeyman6)
                {
                    var keymanLink = new KeymanLink.KeymanLink();
                    if (keymanLink.Initialize())
                    {
                        keymanLink.SelectKeymanKeyboard(null, false);
                    }
                }
                else
                {
                    var keyman = new TavultesoftKeymanClass();
                    keyman.Control.ActiveKeyboard = null;
                }
            }
            catch (Exception)
            {
                // Keyman not installed?
            }
#endif
        }
예제 #2
0
        public bool ActivateKeyboard(KeyboardDescription keyboard)
        {
            CheckDisposed();
#if !MONO
            var keymanKbdDesc = (KeymanKeyboardDescription)keyboard;
            if (keymanKbdDesc.IsKeyman6)
            {
                try
                {
                    var keymanLink = new KeymanLink.KeymanLink();
                    if (!keymanLink.Initialize())
                    {
                        ErrorReport.NotifyUserOfProblem("Keyman6 could not be activated.");
                        return(false);
                    }
                    keymanLink.SelectKeymanKeyboard(keyboard.Id);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                try
                {
                    var keyman        = new TavultesoftKeymanClass();
                    int oneBasedIndex = keyman.Keyboards.IndexOf(keyboard.Id);

                    if (oneBasedIndex < 1)
                    {
                        ErrorReport.NotifyUserOfProblem("The keyboard '{0}' could not be activated using Keyman 7.",
                                                        keyboard.Id);
                        return(false);
                    }
                    keyman.Control.ActiveKeyboard = keyman.Keyboards[oneBasedIndex];
                }
                catch (Exception)
                {
                    // Keyman 7 not installed?
                    return(false);
                }
            }
#endif

            KeyboardController.Instance.ActiveKeyboard = keyboard;
            return(true);
        }
예제 #3
0
        public bool ActivateKeyboard(IKeyboardDefinition keyboard)
        {
            var keymanKbdDesc = (KeymanKeyboardDescription)keyboard;

            if (keymanKbdDesc.IsKeyman6)
            {
                try
                {
                    KeymanLink.KeymanLink keymanLink = new KeymanLink.KeymanLink();
                    if (!keymanLink.Initialize())
                    {
                        Palaso.Reporting.ErrorReport.NotifyUserOfProblem("Keyman6 could not be activated.");
                        return(false);
                    }
                    keymanLink.SelectKeymanKeyboard(keyboard.Layout);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                try
                {
                    TavultesoftKeymanClass keyman = new TavultesoftKeymanClass();
                    int oneBasedIndex             = keyman.Keyboards.IndexOf(keyboard.Layout);

                    if (oneBasedIndex < 1)
                    {
                        Palaso.Reporting.ErrorReport.NotifyUserOfProblem("The keyboard '{0}' could not be activated using Keyman 7.",
                                                                         keyboard.Layout);
                        return(false);
                    }
                    keyman.Control.ActiveKeyboard = keyman.Keyboards[oneBasedIndex];
                }
                catch (Exception)
                {
                    // Keyman 7 not installed?
                    return(false);
                }
            }

            ((IKeyboardControllerImpl)Keyboard.Controller).ActiveKeyboard = keyboard;
            return(true);
        }
예제 #4
0
        public bool ActivateKeyboard(IKeyboardDefinition keyboard)
        {
            var keymanKbdDesc = (KeymanKeyboardDescription)keyboard;
            if (keymanKbdDesc.IsKeyman6)
            {
                try
                {
                    KeymanLink.KeymanLink keymanLink = new KeymanLink.KeymanLink();
                    if (!keymanLink.Initialize())
                    {
                        Palaso.Reporting.ErrorReport.NotifyUserOfProblem("Keyman6 could not be activated.");
                        return false;
                    }
                    keymanLink.SelectKeymanKeyboard(keyboard.Layout);
                }
                catch (Exception)
                {
                    return false;
                }
            }
            else
            {
                try
                {
                    TavultesoftKeymanClass keyman = new TavultesoftKeymanClass();
                    int oneBasedIndex = keyman.Keyboards.IndexOf(keyboard.Layout);

                    if (oneBasedIndex < 1)
                    {
                        Palaso.Reporting.ErrorReport.NotifyUserOfProblem("The keyboard '{0}' could not be activated using Keyman 7.",
                            keyboard.Layout);
                        return false;
                    }
                    keyman.Control.ActiveKeyboard = keyman.Keyboards[oneBasedIndex];
                }
                catch (Exception)
                {
                    // Keyman 7 not installed?
                    return false;
                }
            }

            ((IKeyboardControllerImpl)Keyboard.Controller).ActiveKeyboard = keyboard;
            return true;
        }
예제 #5
0
 public void DeactivateKeyboard(IKeyboardDefinition keyboard)
 {
     try
     {
         if (((KeymanKeyboardDescription)keyboard).IsKeyman6)
         {
             KeymanLink.KeymanLink keymanLink = new KeymanLink.KeymanLink();
             if (keymanLink.Initialize())
             {
                 keymanLink.SelectKeymanKeyboard(null, false);
             }
         }
         else
         {
             TavultesoftKeymanClass keyman = new TavultesoftKeymanClass();
             keyman.Control.ActiveKeyboard = null;
         }
     }
     catch (Exception)
     {
         // Keyman not installed?
     }
 }
예제 #6
0
		public void DeactivateKeyboard(KeyboardDescription keyboard)
		{
			CheckDisposed();
			try
			{
				if (((KeymanKeyboardDescription) keyboard).IsKeyman6)
				{
					var keymanLink = new KeymanLink.KeymanLink();
					if (keymanLink.Initialize())
						keymanLink.SelectKeymanKeyboard(null, false);
				}
				else
				{
					var keyman = new TavultesoftKeymanClass();
					keyman.Control.ActiveKeyboard = null;
				}
			}
			catch (Exception)
			{
				// Keyman not installed?
			}
		}
예제 #7
0
		public bool ActivateKeyboard(KeyboardDescription keyboard)
		{
			CheckDisposed();
			var keymanKbdDesc = (KeymanKeyboardDescription)keyboard;
			if (keymanKbdDesc.IsKeyman6)
			{
				try
				{
					var keymanLink = new KeymanLink.KeymanLink();
					if (!keymanLink.Initialize())
					{
						ErrorReport.NotifyUserOfProblem("Keyman6 could not be activated.");
						return false;
					}
					keymanLink.SelectKeymanKeyboard(keyboard.Id);
				}
				catch (Exception)
				{
					return false;
				}
			}
			else
			{
				try
				{
					var keyman = new TavultesoftKeymanClass();
					int oneBasedIndex = keyman.Keyboards.IndexOf(keyboard.Id);

					if (oneBasedIndex < 1)
					{
						ErrorReport.NotifyUserOfProblem("The keyboard '{0}' could not be activated using Keyman 7.",
							keyboard.Id);
						return false;
					}
					keyman.Control.ActiveKeyboard = keyman.Keyboards[oneBasedIndex];
				}
				catch (Exception)
				{
					// Keyman 7 not installed?
					return false;
				}
			}

			KeyboardController.Instance.ActiveKeyboard = keyboard;
			return true;
		}