Beispiel #1
0
        private void GenerateContent()
        {
            Log.DebugFormat("GenerateContent called. Keyboard language is '{0}' and Keyboard type is '{1}'",
                            Settings.Default.KeyboardAndDictionaryLanguage, Keyboard != null ? Keyboard.GetType() : null);

            //Clear out point to key map and pause input service
            PointToKeyValueMap = null;
            if (InputService != null)
            {
                InputService.RequestSuspend();
            }

            object newContent = ErrorContent;

            if (Keyboard is ViewModelKeyboards.Alpha)
            {
                switch (Settings.Default.KeyboardAndDictionaryLanguage)
                {
                case Languages.CroatianCroatia:
                    newContent = new CroatianViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.DutchBelgium:
                    newContent = new DutchViews.BelgiumAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.DutchNetherlands:
                    newContent = new DutchViews.NetherlandsAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.FrenchFrance:
                    newContent = new FrenchViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GermanGermany:
                    newContent = new GermanViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GreekGreece:
                    newContent = new GreekViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.RussianRussia:
                    newContent = new RussianViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.SpanishSpain:
                    newContent = new SpanishViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.TurkishTurkey:
                    newContent = new TurkishViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                default:
                    newContent = new EnglishViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationAlpha)
            {
                switch (Settings.Default.KeyboardAndDictionaryLanguage)
                {
                case Languages.CroatianCroatia:
                    newContent = new CroatianViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.DutchBelgium:
                    newContent = new DutchViews.BelgiumConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.DutchNetherlands:
                    newContent = new DutchViews.NetherlandsConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.FrenchFrance:
                    newContent = new FrenchViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GermanGermany:
                    newContent = new GermanViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GreekGreece:
                    newContent = new GreekViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.RussianRussia:
                    newContent = new RussianViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.SpanishSpain:
                    newContent = new SpanishViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.TurkishTurkey:
                    newContent = new TurkishViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                default:
                    newContent = new EnglishViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols)
            {
                newContent = new CommonViews.ConversationNumericAndSymbols {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies1)
            {
                newContent = new CommonViews.Currencies1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies2)
            {
                newContent = new CommonViews.Currencies2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics1)
            {
                newContent = new CommonViews.Diacritics1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics2)
            {
                newContent = new CommonViews.Diacritics2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics3)
            {
                newContent = new CommonViews.Diacritics3 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Language)
            {
                newContent = new CommonViews.Language {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Menu)
            {
                newContent = new CommonViews.Menu {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Minimised)
            {
                newContent = new CommonViews.Minimised {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Mouse)
            {
                newContent = new CommonViews.Mouse {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols2)
            {
                newContent = new CommonViews.NumericAndSymbols2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols3)
            {
                newContent = new CommonViews.NumericAndSymbols3 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols1)
            {
                newContent = new CommonViews.NumericAndSymbols1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.PhysicalKeys)
            {
                newContent = new CommonViews.PhysicalKeys {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.SizeAndPosition)
            {
                newContent = new CommonViews.SizeAndPosition {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.YesNoQuestion)
            {
                newContent = new CommonViews.YesNoQuestion {
                    DataContext = Keyboard
                };
            }

            Content = newContent;
        }
Beispiel #2
0
        private void GenerateContent()
        {
            Log.DebugFormat("GenerateContent called. Language setting is '{0}' and Keyboard type is '{1}'", 
                Settings.Default.Language, Keyboard != null ? Keyboard.GetType() : null);

            var cultureInfo = Settings.Default.Language.ToCultureInfo();
            if (!Equals(cultureInfo, Properties.Resources.Culture)) 
            {
                //Updates UI and Resource Culture to reflect selected language
                Thread.CurrentThread.CurrentCulture = cultureInfo;
                Thread.CurrentThread.CurrentUICulture = cultureInfo;
                Properties.Resources.Culture = cultureInfo;
            }
            
            //Clear out point to key map and pause input service
            PointToKeyValueMap = null;
            if(InputService != null)
            {
                InputService.RequestSuspend();
            }
            
            object newContent = ErrorContent;

            if (Keyboard is ViewModelKeyboards.Alpha)
            {
                switch (Settings.Default.Language)
                {
                    case Languages.EnglishUS:
                    case Languages.EnglishUK:
                    case Languages.EnglishCanada:
                        newContent = new EnglishViews.Alpha {DataContext = Keyboard};
                        break;
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Alpha {DataContext = Keyboard};
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Alpha { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationAlpha)
            {
                switch (Settings.Default.Language)
                {
                    case Languages.EnglishUS:
                    case Languages.EnglishUK:
                    case Languages.EnglishCanada:
                        newContent = new EnglishViews.ConversationAlpha { DataContext = Keyboard };
                        break;
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.ConversationAlpha {DataContext = Keyboard};
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.ConversationAlpha { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols)
            {
                newContent = new CommonViews.ConversationNumericAndSymbols { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies1)
            {
                newContent = new CommonViews.Currencies1 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies2)
            {
                newContent = new CommonViews.Currencies2 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics1)
            {
                switch (Settings.Default.Language)
                {
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Diacritics1 { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Diacritics1 { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new CommonViews.Diacritics1 { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics2)
            {
                switch (Settings.Default.Language)
                {
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Diacritics2 { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Diacritics2 { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new CommonViews.Diacritics2 { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics3)
            {
                switch (Settings.Default.Language)
                {
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Diacritics3 { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Diacritics3 { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new CommonViews.Diacritics3 { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Menu)
            {
                newContent = new CommonViews.Menu { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Minimised)
            {
                newContent = new CommonViews.Minimised { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Mouse)
            {
                newContent = new CommonViews.Mouse { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols2)
            {
                newContent = new CommonViews.NumericAndSymbols2 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols3)
            {
                newContent = new CommonViews.NumericAndSymbols3 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols1)
            {
                newContent = new CommonViews.NumericAndSymbols1 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.PhysicalKeys)
            {
                newContent = new CommonViews.PhysicalKeys { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.SizeAndPosition)
            {
                newContent = new CommonViews.SizeAndPosition { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.YesNoQuestion)
            {
                newContent = new CommonViews.YesNoQuestion { DataContext = Keyboard };
            }

            Content = newContent;
        }
Beispiel #3
0
        private void GenerateContent()
        {
            Log.DebugFormat("GenerateContent called. Language setting is '{0}' and Keyboard type is '{1}'",
                            Settings.Default.Language, Keyboard != null ? Keyboard.GetType() : null);

            var cultureInfo = Settings.Default.Language.ToCultureInfo();

            if (!Equals(cultureInfo, Properties.Resources.Culture))
            {
                //Updates UI and Resource Culture to reflect selected language
                Thread.CurrentThread.CurrentCulture   = cultureInfo;
                Thread.CurrentThread.CurrentUICulture = cultureInfo;
                Properties.Resources.Culture          = cultureInfo;
            }

            //Clear out point to key map and pause input service
            PointToKeyValueMap = null;
            if (InputService != null)
            {
                InputService.RequestSuspend();
            }

            object newContent = ErrorContent;

            if (Keyboard is ViewModelKeyboards.Alpha)
            {
                switch (Settings.Default.Language)
                {
                case Languages.EnglishUS:
                case Languages.EnglishUK:
                case Languages.EnglishCanada:
                    newContent = new EnglishViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.FrenchFrance:
                    newContent = new FrenchViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GermanGermany:
                    newContent = new GermanViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationAlpha)
            {
                switch (Settings.Default.Language)
                {
                case Languages.EnglishUS:
                case Languages.EnglishUK:
                case Languages.EnglishCanada:
                    newContent = new EnglishViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.FrenchFrance:
                    newContent = new FrenchViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GermanGermany:
                    newContent = new GermanViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols)
            {
                newContent = new CommonViews.ConversationNumericAndSymbols {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies1)
            {
                newContent = new CommonViews.Currencies1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies2)
            {
                newContent = new CommonViews.Currencies2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics1)
            {
                switch (Settings.Default.Language)
                {
                case Languages.FrenchFrance:
                    newContent = new FrenchViews.Diacritics1 {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GermanGermany:
                    newContent = new GermanViews.Diacritics1 {
                        DataContext = Keyboard
                    };
                    break;

                default:
                    newContent = new CommonViews.Diacritics1 {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics2)
            {
                switch (Settings.Default.Language)
                {
                case Languages.FrenchFrance:
                    newContent = new FrenchViews.Diacritics2 {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GermanGermany:
                    newContent = new GermanViews.Diacritics2 {
                        DataContext = Keyboard
                    };
                    break;

                default:
                    newContent = new CommonViews.Diacritics2 {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics3)
            {
                switch (Settings.Default.Language)
                {
                case Languages.FrenchFrance:
                    newContent = new FrenchViews.Diacritics3 {
                        DataContext = Keyboard
                    };
                    break;

                case Languages.GermanGermany:
                    newContent = new GermanViews.Diacritics3 {
                        DataContext = Keyboard
                    };
                    break;

                default:
                    newContent = new CommonViews.Diacritics3 {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Menu)
            {
                newContent = new CommonViews.Menu {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Minimised)
            {
                newContent = new CommonViews.Minimised {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Mouse)
            {
                newContent = new CommonViews.Mouse {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols2)
            {
                newContent = new CommonViews.NumericAndSymbols2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols3)
            {
                newContent = new CommonViews.NumericAndSymbols3 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols1)
            {
                newContent = new CommonViews.NumericAndSymbols1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.PhysicalKeys)
            {
                newContent = new CommonViews.PhysicalKeys {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.SizeAndPosition)
            {
                newContent = new CommonViews.SizeAndPosition {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.YesNoQuestion)
            {
                newContent = new CommonViews.YesNoQuestion {
                    DataContext = Keyboard
                };
            }

            Content = newContent;
        }
Beispiel #4
0
        private void GenerateContent()
        {
            Log.DebugFormat("GenerateContent called. Keyboard language is '{0}' and Keyboard type is '{1}'", 
                Settings.Default.KeyboardAndDictionaryLanguage, Keyboard != null ? Keyboard.GetType() : null);

            //Clear out point to key map and pause input service
            PointToKeyValueMap = null;
            if(InputService != null)
            {
                InputService.RequestSuspend();
            }
            
            object newContent = ErrorContent;

            if (Keyboard is ViewModelKeyboards.Alpha)
            {
                switch (Settings.Default.KeyboardAndDictionaryLanguage)
                {
                    case Languages.DutchBelgium:
                        newContent = new DutchViews.BelgiumAlpha { DataContext = Keyboard };
                        break;
                    case Languages.DutchNetherlands:
                        newContent = new DutchViews.NetherlandsAlpha { DataContext = Keyboard };
                        break;
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Alpha { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Alpha { DataContext = Keyboard };
                        break;
                    case Languages.RussianRussia:
                        newContent = new RussianViews.Alpha { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new EnglishViews.Alpha { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationAlpha)
            {
                switch (Settings.Default.KeyboardAndDictionaryLanguage)
                {
                    case Languages.DutchBelgium:
                        newContent = new DutchViews.BelgiumConversationAlpha { DataContext = Keyboard };
                        break;
                    case Languages.DutchNetherlands:
                        newContent = new DutchViews.NetherlandsConversationAlpha { DataContext = Keyboard };
                        break;
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.ConversationAlpha { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.ConversationAlpha { DataContext = Keyboard };
                        break;
                    case Languages.RussianRussia:
                        newContent = new RussianViews.ConversationAlpha { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new EnglishViews.ConversationAlpha { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols)
            {
                newContent = new CommonViews.ConversationNumericAndSymbols { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies1)
            {
                newContent = new CommonViews.Currencies1 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies2)
            {
                newContent = new CommonViews.Currencies2 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics1)
            {
                switch (Settings.Default.KeyboardAndDictionaryLanguage)
                {
                    case Languages.DutchBelgium:
                    case Languages.DutchNetherlands:
                        newContent = new DutchViews.Diacritics1 { DataContext = Keyboard };
                        break;
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Diacritics1 { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Diacritics1 { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new CommonViews.Diacritics1 { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics2)
            {
                switch (Settings.Default.KeyboardAndDictionaryLanguage)
                {
                    case Languages.DutchBelgium:
                    case Languages.DutchNetherlands:
                        newContent = new DutchViews.Diacritics2 { DataContext = Keyboard };
                        break;
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Diacritics2 { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Diacritics2 { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new CommonViews.Diacritics2 { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics3)
            {
                switch (Settings.Default.KeyboardAndDictionaryLanguage)
                {
                    case Languages.DutchBelgium:
                    case Languages.DutchNetherlands:
                        newContent = new DutchViews.Diacritics3 { DataContext = Keyboard };
                        break;
                    case Languages.FrenchFrance:
                        newContent = new FrenchViews.Diacritics3 { DataContext = Keyboard };
                        break;
                    case Languages.GermanGermany:
                        newContent = new GermanViews.Diacritics3 { DataContext = Keyboard };
                        break;
                    default:
                        newContent = new CommonViews.Diacritics3 { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.Language)
            {
                newContent = new CommonViews.Language { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Menu)
            {
                newContent = new CommonViews.Menu { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Minimised)
            {
                newContent = new CommonViews.Minimised { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Mouse)
            {
                newContent = new CommonViews.Mouse { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols2)
            {
                newContent = new CommonViews.NumericAndSymbols2 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols3)
            {
                newContent = new CommonViews.NumericAndSymbols3 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols1)
            {
                newContent = new CommonViews.NumericAndSymbols1 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.PhysicalKeys)
            {
                newContent = new CommonViews.PhysicalKeys { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.SizeAndPosition)
            {
                newContent = new CommonViews.SizeAndPosition { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.YesNoQuestion)
            {
                newContent = new CommonViews.YesNoQuestion { DataContext = Keyboard };
            }

            Content = newContent;
        }
Beispiel #5
0
        private void GenerateContent()
        {
            Log.DebugFormat("GenerateContent called. Language setting is '{0}' and Keyboard type is '{1}'",
                            Settings.Default.Language, Keyboard != null ? Keyboard.GetType() : null);

            //Clear out point to key map and pause input service
            PointToKeyValueMap = null;
            if (InputService != null)
            {
                InputService.RequestSuspend();
            }

            object newContent = ErrorContent;

            if (Keyboard is ViewModelKeyboards.Alpha)
            {
                switch (Settings.Default.Language)
                {
                case Languages.AmericanEnglish:
                case Languages.BritishEnglish:
                case Languages.CanadianEnglish:
                    newContent = new EnglishViews.Alpha {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationAlpha)
            {
                switch (Settings.Default.Language)
                {
                case Languages.AmericanEnglish:
                case Languages.BritishEnglish:
                case Languages.CanadianEnglish:
                    newContent = new EnglishViews.ConversationAlpha {
                        DataContext = Keyboard
                    };
                    break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols)
            {
                newContent = new CommonViews.ConversationNumericAndSymbols {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies1)
            {
                newContent = new CommonViews.Currencies1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies2)
            {
                newContent = new CommonViews.Currencies2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics1)
            {
                newContent = new CommonViews.Diacritics1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics2)
            {
                newContent = new CommonViews.Diacritics2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics3)
            {
                newContent = new CommonViews.Diacritics3 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Menu)
            {
                newContent = new CommonViews.Menu {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Minimised)
            {
                newContent = new CommonViews.Minimised {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.Mouse)
            {
                newContent = new CommonViews.Mouse {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols2)
            {
                newContent = new CommonViews.NumericAndSymbols2 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols3)
            {
                newContent = new CommonViews.NumericAndSymbols3 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols1)
            {
                newContent = new CommonViews.NumericAndSymbols1 {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.PhysicalKeys)
            {
                newContent = new CommonViews.PhysicalKeys {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.SizeAndPosition)
            {
                newContent = new CommonViews.SizeAndPosition {
                    DataContext = Keyboard
                };
            }
            else if (Keyboard is ViewModelKeyboards.YesNoQuestion)
            {
                newContent = new CommonViews.YesNoQuestion {
                    DataContext = Keyboard
                };
            }

            Content = newContent;
        }
Beispiel #6
0
        private void GenerateContent()
        {
            Log.DebugFormat("GenerateContent called. Language setting is '{0}' and Keyboard type is '{1}'", 
                Settings.Default.Language, Keyboard != null ? Keyboard.GetType() : null);
            
            //Clear out point to key map and pause input service
            PointToKeyValueMap = null;
            if(InputService != null)
            {
                InputService.RequestSuspend();
            }
            
            object newContent = ErrorContent;

            if (Keyboard is ViewModelKeyboards.Alpha)
            {
                switch (Settings.Default.Language)
                {
                    case Languages.AmericanEnglish:
                    case Languages.BritishEnglish:
                    case Languages.CanadianEnglish:
                        newContent = new EnglishViews.Alpha {DataContext = Keyboard};
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationAlpha)
            {
                switch (Settings.Default.Language)
                {
                    case Languages.AmericanEnglish:
                    case Languages.BritishEnglish:
                    case Languages.CanadianEnglish:
                        newContent = new EnglishViews.ConversationAlpha { DataContext = Keyboard };
                        break;
                }
            }
            else if (Keyboard is ViewModelKeyboards.ConversationNumericAndSymbols)
            {
                newContent = new CommonViews.ConversationNumericAndSymbols { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies1)
            {
                newContent = new CommonViews.Currencies1 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Currencies2)
            {
                newContent = new CommonViews.Currencies2 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics1)
            {
                newContent = new CommonViews.Diacritics1 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics2)
            {
                newContent = new CommonViews.Diacritics2 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Diacritics3)
            {
                newContent = new CommonViews.Diacritics3 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Menu)
            {
                newContent = new CommonViews.Menu { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Minimised)
            {
                newContent = new CommonViews.Minimised { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.Mouse)
            {
                newContent = new CommonViews.Mouse { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols2)
            {
                newContent = new CommonViews.NumericAndSymbols2 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols3)
            {
                newContent = new CommonViews.NumericAndSymbols3 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.NumericAndSymbols1)
            {
                newContent = new CommonViews.NumericAndSymbols1 { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.PhysicalKeys)
            {
                newContent = new CommonViews.PhysicalKeys { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.SizeAndPosition)
            {
                newContent = new CommonViews.SizeAndPosition { DataContext = Keyboard };
            }
            else if (Keyboard is ViewModelKeyboards.YesNoQuestion)
            {
                newContent = new CommonViews.YesNoQuestion { DataContext = Keyboard };
            }
            
            var contentAsFrameworkElement = newContent as FrameworkElement;
            if (contentAsFrameworkElement != null)
            {
                if (contentAsFrameworkElement.IsLoaded)
                {
                    ReactToNewContentLoaded();
                }
                else
                {
                    RoutedEventHandler loaded = null;
                    loaded = (sender, args) =>
                    {
                        ReactToNewContentLoaded();
                        contentAsFrameworkElement.Loaded -= loaded;
                    };
                    contentAsFrameworkElement.Loaded += loaded;
                }
            }

            Content = newContent;
        }