Beispiel #1
0
 public KanaVM(KanaBoardVM boardVM, CodePoint codePoint, string romaji, int x, int y)
 {
     this.boardVM = boardVM;
     CodePoint    = codePoint;
     Romaji       = romaji;
     X            = x;
     Y            = y;
 }
Beispiel #2
0
        public MainWindowVM(
            ILanguageService lang,
            KanaBoardVM hiraganaBoard,
            KanaBoardVM katakanaBoard,
            UsageDataSourcePreviewVM usageDataSourceVm,
            KanjiRadicalLookupControlVM kanjiLookupVm,
            Func <string> aboutTextProvider)
        {
            HiraganaBoard          = hiraganaBoard;
            KatakanaBoard          = katakanaBoard;
            this.aboutTextProvider = aboutTextProvider;
            UsageDataSourceVM      = usageDataSourceVm;
            TextBuffers.Add(new TextBufferVM("Scratchpad", lang));
            TextBuffers.Add(new TextBufferVM("Main", lang));
            ClipboardTextBuffer = new TextBufferVM("Clipboard", lang);
            KanjiLookupVM       = kanjiLookupVm;
            hook = new ClipboardHook();
            hook.ClipboardChanged += SetContent;
            PlaceInClipboard       = new RelayCommand((p) =>
            {
                var codePoint = (CodePoint)p;
                Clipboard.SetText(codePoint.ToString());
            });
            SendToCurrent = new RelayCommand(() =>
            {
                if (CurrentTextBuffer == null)
                {
                    return;
                }
                CurrentTextBuffer.RawOutput = ClipboardTextBuffer.RawOutput;
            });
            SendToScratchpad = new RelayCommand(() =>
            {
                TextBuffers[0].RawOutput = ClipboardTextBuffer.RawOutput;
            });
            SearchWeb = new RelayCommand(query =>
            {
                if (CurrentTextBuffer == null)
                {
                    return;
                }
                if (SearchEngineIndex == -1)
                {
                    return;
                }

                LaunchWebBrowserAt(SearchEngines[SearchEngineIndex].BuildSearch(CurrentTextBuffer.SelectionInfo.GetRequest().QueryText));
            });
            SwitchToTab = new RelayCommand(tab =>
            {
                switch ((string)tab)
                {
                case "project":
                    TabIndex = 0;
                    break;

                case "usage1":
                    TabIndex = 1;
                    break;

                case "hiragana":
                    TabIndex = 3;
                    break;

                case "kanji":
                    TabIndex = 4;
                    break;

                case "katakana":
                    TabIndex = 5;
                    break;
                    ;
                }
            });
            DataSourceForceRefresh = new RelayCommand(() =>
            {
                usageDataSourceVm.Search(usageDataSourceVm.Request);
            });
        }