コード例 #1
0
        public static bool ShowWall(bool buttons, string caption,string text)
        {
            var w = new TextWallWindow();
            w.textbox.Text = text;
            w.Title = caption;
            if (!buttons)
            {
                w.ButtonStack.Visibility = Visibility.Collapsed;
            }

            return w.ShowDialog() == true;
        }
コード例 #2
0
        public static bool ShowWall(bool buttons, string caption, string text)
        {
            var w = new TextWallWindow();

            w.textbox.Text = text;
            w.Title        = caption;
            if (!buttons)
            {
                w.ButtonStack.Visibility = Visibility.Collapsed;
            }

            return(w.ShowDialog() == true);
        }
コード例 #3
0
ファイル: WinSetup.xaml.cs プロジェクト: BryErn1996/NanoTrans
        private void GetDictionaryFromZip(Stream s)
        {
            ZipFile zf    = ZipFile.Read(s);
            var     entry = zf.Entries.Where(en => en.FileName.EndsWith(".aff")).ToArray();

            if (entry.Length > 0)
            {
                var aff = entry[0];
                var dic = zf.Entries.Where(en => en.FileName == System.IO.Path.GetFileNameWithoutExtension(aff.FileName) + ".dic").FirstOrDefault();

                if (dic != null)
                {
                    if (MessageBox.Show(this, string.Format(Properties.Strings.MessageBoxDictionaryConfirmLoad, System.IO.Path.GetFileNameWithoutExtension(aff.FileName)), Properties.Strings.MessageBoxQuestionCaption, MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
                    {
                        var readme = zf.Entries.Where(en => en.FileName.ToLower().Contains("readme")).FirstOrDefault();
                        if (readme != null)
                        {
                            string ss = new StreamReader(readme.OpenReader()).ReadToEnd();

                            if (TextWallWindow.ShowWall(true, Properties.Strings.OODictionaryLicenceTitle, ss))
                            {
                                if (SpellChecker.SpellEngine != null)
                                {
                                    SpellChecker.SpellEngine.Dispose();
                                    SpellChecker.SpellEngine = null;
                                }


                                File.WriteAllText(FilePaths.GetWritePath("data\\readme_slovniky.txt"), ss);
                                string p = FilePaths.GetWritePath("data\\cs_CZ.aff");

                                using (Stream fs = File.Create(p))
                                    aff.Extract(fs);
                                p = FilePaths.GetWritePath("data\\cs_CZ.dic");

                                using (Stream fs = File.Create(p))
                                    dic.Extract(fs);

                                SpellChecker.LoadVocabulary();
                                MessageBox.Show(this, Properties.Strings.MessageBoxDictinaryInstalled, Properties.Strings.MessageBoxInfoCaption, MessageBoxButton.OK, MessageBoxImage.Information);
                            }
                        }
                    }
                }
            }
        }