void SaveState(f.SentenceList sentenceList) { CF.SetValue(sentenceList.Name + _FileName, sentenceList.FileName); CF.SetValue(sentenceList.Name + _SentenceNumber, sentenceList.SafeSelectedIndex.ToString()); CF.SetValue(sentenceList.Name + _FontSize, sentenceList.FontSize.ToString()); // CF.SetValue(sentenceList.Name + "ZoomFactor", sentenceList.TextBox.ZoomFactor.ToString()); }
int _PlayState = -1; // 9 вроде загрузка void Player_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) { Console.WriteLine(e.newState); if (_PlayState == 9 && e.newState == 3) // значит это открытие после загрузки { //this.BeginInvoke(new MethodInvoker(DoDelayedPause)); Dictionary <int, string> langs = GetAudioLanguages(); if (langs.Count > 0) { foreach (KeyValuePair <int, string> pair in langs) { int val = CF.GetValue("AudioLanguageIndex", pair.Key); this.AudioLanguageIndex = val; break; } } } else if (e.newState == 3) // включили проигрывание { //if (!ParentList.timerForVideoManualControl.Enabled) // this.btPauseMode.Checked = false; } _PlayState = e.newState; OffOnAutoSyncrForSubtitles(); }
public void RestoreState() { try { // ---- LanguageDirection ---- CF.AssignValues("MainForm", this, new Point(50, 50), new Size(850, 920)); this.btTopMost.Checked = CF.GetValue("TopMost", false); CurrentLangInfo.InitLanguagesMenu(this.miLanguages); // CurrentLangInfo.InitLanguagesMenu(this.toolStripMainMenu); CurrentLangInfo.LanguageDirection = CF.GetValue("LanguageDirection", CurrentLangInfo.DefaultLangDir); AssignLastUsedDict(CF.GetValue("LastUsedDict", GoogleDictionary.MainTitle)); string history = CF.GetValue("HistoryList", "WELCOME"); if (!string.IsNullOrEmpty(history)) { this.comboBox.Items.AddRange(history.Split(';')); this.comboBox.SelectedIndex = 0; } CheckButtonsPrevNext(); UpdateFormCaption(); } catch (Exception ex) { Messages.ErrorOnRestoringApp(ex); } }
public void RestoreState() { try { // ---- LanguageDirection ---- // CF. CF.AssignValues("MainForm", this, new Point(100, 100), new Size(871, 712)); string _LessonFileName = CF.GetValue("LessonFileName", CF.GetFolderForUserFiles() + @"\Video.EN.srt.lesson"); _LessonFileName = FileManager.FindPath(_LessonFileName, @"\my_video\my_movie.lesson - specify a file with your lesson"); if (string.IsNullOrEmpty(this.tutorList1.FileName) && File.Exists(_LessonFileName)) { this.LessonFileName = _LessonFileName; } // CurrentLangInfo.InitLanguagesMenu(this.toolStrip1); CurrentLangInfo.InitLanguagesMenu(this.miLanguages); CurrentLangInfo.LanguageDirection = CF.GetValue("LanguageDirection", CurrentLangInfo.DefaultLangDir); this.menuForSelected.LastDictName = CF.GetValue("LastDictionary", GoogleDictionary.MainTitle); this.menuForSelected.miHideTranslation.Checked = CF.GetValue("IsHidedTranslation", false); this.itemShowHidePreviousScore.Checked = CF.GetValue("ShowPreviousScore", false); item_CheckStateChanged(null, EventArgs.Empty); } catch (Exception ex) { Messages.ErrorOnRestoringApp(ex); } }
public void FillByWords(string curenLangPair) { string folder = CF.GetFolderForUserFiles() + "history\\"; if (!Directory.Exists(folder)) { MessageBox.Show(this, string.Format("History was not created. Directory '{0}' not founded", folder), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (string dir in Directory.GetDirectories(folder)) { // Directory. string langPair = FileManager.GetLastDirName(dir); TreeNode tnLang = tv.Nodes.Add(langPair); if (!string.IsNullOrEmpty(curenLangPair) && curenLangPair.Equals(langPair)) { tv.SelectedNode = tnLang; tnLang.Expand(); } tnLang.Tag = dir; foreach (string dirLetter in Directory.GetDirectories(dir)) { TreeNode tnLetter = tnLang.Nodes.Add(FileManager.GetLastDirName(dirLetter)); tnLetter.Tag = dirLetter; foreach (string word in Directory.GetFiles(dirLetter)) { TreeNode tnWord = tnLetter.Nodes.Add(FileManager.GetFileName(word)); tnWord.Tag = word; } } } }
private void RestoreState(f.SentenceList sentenceList, bool isRestoreFileName) { if (isRestoreFileName) { sentenceList.FileName = CF.GetValue(sentenceList.Name + _FileName, ""); } sentenceList.SafeSelectedIndex = CF.GetValue(sentenceList.Name + _SentenceNumber, 0); sentenceList.FontSize = CF.GetValue(sentenceList.Name + _FontSize, 11.5f); // 9 //sentenceList.TextBox.ZoomFactor = CF.GetValue(sentenceList.Name + "ZoomFactor", 1); }
void Tutor_FormClosed(object sender, FormClosedEventArgs e) { SaveScore(); CF.SetValue("MainForm", this); CF.SetValue("LessonFileName", this.LessonFileName); CF.SetValue("LanguageDirection", this.textArea.LangDir.ToString()); CF.SetValue("IsHidedTranslation", this.menuForSelected.miHideTranslation.Checked); CF.SetValue("LastDictionary", this.menuForSelected.LastDictName); CF.SetValue("ShowPreviousScore", this.itemShowHidePreviousScore.Checked); }
public static void ShowHelp(Control control, string text, bool controlFirstStart) { if (controlFirstStart) { if (CF.GetValue(m_KeyPrefix + control.Name, bool.FalseString) == bool.TrueString) { return; } } ShowHelp(control, text); }
public static string CheckAndCreateFolder(string targetFolder) { // C:\Users\serg\Documents\easy4learn\Euronews string folder = CF.GetFolderForUserFiles() + "\\" + targetFolder; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } return(folder); }
public VideoForm() { InitializeComponent(); this.Load += new System.EventHandler(this.VideoForm_Load); // this.ShowInTaskbar = false; // тогда не открывается во весь экран видео this.TopMostManualExplicit = this.TopMost = CF.GetValue("VideoFormTopMost", true); this.ShowInTaskbar = CF.GetValue("VideoFormShowInTaskbar", false); this.StretchVideoToFit = CF.GetValue("StretchVideoToFit", true); CF.AssignValues("VideoForm", this, new Point(526, 109), new Size(588, 380)); }
private string GetFileName(string word, string codeForm, string codeTo) { // string dir = string.Format(@"{0}\history\{1}-{2}\{3}", Directory.GetCurrentDirectory(), codeForm.ToLower(), codeTo.ToLower(), word.ToLower()[0]); string dir = string.Format(@"{0}history\{1}-{2}\{3}", CF.GetFolderForUserFiles(), codeForm.ToLower(), codeTo.ToLower(), word.ToLower()[0]); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string fileName = string.Format(@"{0}\{1}.htm", dir, word); return(fileName); }
public void RestoreState() { try { // ---- LanguageDirection ---- CF.AssignValues("MainForm", this); CurrentLangInfo.LanguageDirection = CF.GetValue("LanguageDirection", CurrentLangInfo.DefaultLangDir); CurrentLangInfo.InitLanguagesMenu(this.miLanguages); } catch { //TODO: add mesage for detail about urestored state } }
// ---------- For SentenceList ---------- private void SaveState() { SaveState(this.reader.TwinList.ListEn); SaveState(this.reader.TwinList.ListNative); CF.SetValue(CF.timeshift_video, this.reader.TwinList.ListEn.TimeShift); CF.SetValue("ShowParrallelSubtitles", this.btShowParrallelSubtitles.Checked); CF.SetValue("LanguageDirection", this.reader.LanguageDirection); // if (!string.IsNullOrEmpty(this.reader.TwinList.ListEn.VideoFileName)) CF.SetValue("VideoFileName", this.reader.TwinList.ListEn.VideoFileName); //CF.SetValue("ListEn_FileName", this.reader.TwinList.ListEn.FileName); CF.SetValue("Lesson_FileName", this.reader.TwinList.ListEn.LessonFileName); // --- bool ---- //CF.SetValue("ShowLeftText", this.reader.TwinText.menuForSelected1.miShowLeftText.Checked); //CF.SetValue("ShowMenuOnTextSelection", this.reader.TwinText.menuForSelected1.miShowMenuOnTextSelection.Checked); //CF.SetValue("PopupAsMonoDictionary", this.reader.TwinText.menuForSelected1.IsShowPopupWindow); CF.SetValue("ListenByClick", this.reader.TwinText.MenuForSelected.IsListenByClick); CF.SetValue("AddWordToTutorOnDoubleClick", this.reader.TwinText.MenuForSelected.IsAddWordToTutor); CF.SetValue("ShowPopupWindow", this.reader.TwinText.MenuForSelected.IsShowPopupWindow); CF.SetValue("MainForm", this); CF.SetValue("TextTwin", this.reader.TwinText.Height); CF.SetValue("TextForeign_Heigh", this.reader.TwinText.textForeignAndTran.paForeignText.Height); CF.SetValue("TextNative", this.reader.TwinText.textForeignAndTran.Width); CF.SetValue("ListNative", this.reader.TwinList.ListNative.Width); CF.SetValue("TextForeign_FontSize", this.reader.TwinText.textForeignAndTran.ForeignText.ZoomFactor); // TODO: so-so ZOOM // CF.SetValue("TextTranslate_FontSize", this.reader.TwinText.textForeignAndTran.TranslateText_del.ZoomFactor); CF.SetValue("TextNative_FontSize", this.reader.TwinText.textNative.ZoomFactor); CF.SetValue("LastDictionary", this.reader.TwinText.MenuForSelected.LastDictName); CF.SetValue("IsHidedTranslation", this.reader.TwinText.MenuForSelected.miHideTranslation.Checked); if (VideoForm.IsFormAccesible && VideoForm.CurrentForm.Visible) //TODO: можно закрыть видео форму раньше .. и тогда настройки не сохранятся { CF.SetValue("VideoFormTopMost", VideoForm.CurrentForm.TopMostManualExplicit); CF.SetValue("AudioLanguageIndex", VideoForm.CurrentVideoContrl.AudioLanguageIndex); CF.SetValue("VideoFormShowInTaskbar", VideoForm.CurrentForm.ShowInTaskbar); CF.SetValue("StretchVideoToFit", VideoForm.CurrentForm.StretchVideoToFit); CF.SetValue("VideoForm", VideoForm.CurrentForm); } //else //{ // if (VideoForm.IsVideoControlAccesible) // CF.SetValue(video_contrl_width, VideoForm.CurrentVideoContrl.Width); //} CF.SetValue(text_lists_width, this.reader.TwinList.paLists.Width); }
public static string GetFolderForFileSelection(string fileName) { string ret = ""; if (!string.IsNullOrEmpty(fileName) && Directory.Exists(Path.GetDirectoryName(fileName))) { ret = Path.GetDirectoryName(fileName); } else if (VideoUnit != null && Directory.Exists(VideoUnit.path)) { ret = VideoUnit.path; } else { ret = CF.GetFolderForUserFiles(); // Application.CommonAppDataPath; } return(ret); }
void Tutor_FormClosed(object sender, FormClosedEventArgs e) { CF.SetValue("MainForm", this); CF.SetValue("TopMost", this.TopMost); CF.SetValue("LanguageDirection", this.LangDir); if (this.LastUsedDict != null) { CF.SetValue("LastUsedDict", ((RunDictContent)this.LastUsedDict.Tag).Providers[0].ToString()); } #region HistoryList List <string> toSave = new List <string>(); foreach (object ob in this.comboBox.Items) { string word = ob as string; if (ob is HistoryItem) { word = ((HistoryItem)ob).Word; } if (toSave.Contains(word) || string.IsNullOrEmpty(word)) { continue; } toSave.Add(word); if (toSave.Count > 300) { break; } } string history = ""; foreach (string s in toSave) { if (!string.IsNullOrEmpty(history)) { history += ";"; } history += s; } CF.SetValue("HistoryList", history); #endregion }
public Y() { InitializeComponent(); m_FontForExample = this.tv1.Font; //m_FontForSpeechPart = new Font(this.tv1.Font, FontStyle.Underline); m_FontForPartSpeech = new Font(this.tv1.Font.Name, this.tv1.Font.Size - 1, FontStyle.Underline); m_FontForServiceNode = new Font(this.tv1.Font.Name, this.tv1.Font.Size, FontStyle.Italic); this.txWord.Text = ""; this.txSelectedCard.Text = ""; ShowIndex(); #region Lucida Sans Unicode //string fontName = "Lucida Sans Unicode"; //Font fnt = new Font(fontName, 11); //if (fnt.Name != fontName) // MessageBox.Show("Font " + fontName + " not found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); //else //{ // this.txPhonetic.Font = fnt; // this.txWord.Font = fnt; //} #endregion this.tv1.Nodes.Clear(); this.tv1.BeforeCheck += new TreeViewCancelEventHandler(tv1_BeforeCheck); this.tv1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tv1_BeforeExpand); this.tv1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.tv1_AfterCheck); this.tv1.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.tv1_AfterExpand); this.tv1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tv1_AfterSelect); this.tv1.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.tv1_AfterExpand); this.tv1.AddToVocabulary += new System.Windows.Forms.TreeViewEventHandler(this.tv1_AddToVocabulary); this.tv1.Remove += new System.Windows.Forms.TreeViewEventHandler(this.tv1_Remove); this.tv1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tv1_KeyDown); AssignHelp(this.Controls); this.miAutohistoryforcards.Click += new System.EventHandler(this.miAutohistoryforcards_Click); this.menuForTree.Opening += new System.ComponentModel.CancelEventHandler(this.menuForTree_Opening); this.miAutohistoryforcards.Checked = CF.GetValue(autohistoryForCards, bool.FalseString) == bool.TrueString; }
public static List <VideoUnit> GetUnits() { List <VideoUnit> result = new List <VideoUnit>(); string path = CF.GetFolderForUserFiles() + "\\" + EuronewsBrowser.rootFolderName + "\\"; try { if (Directory.Exists("path")) { foreach (string p in Directory.GetDirectories(path).Reverse()) { result.Add(GetUnit(p + "\\")); // break; } } } catch { Console.WriteLine(path); //TODO: working with paths } return(result); }
void Tutor_FormClosed(object sender, FormClosedEventArgs e) { CF.SetValue("MainForm", this); CF.SetValue("LanguageDirection", this.LangPair); CF.Config.Save(); // (System.Configuration.ConfigurationSaveMode.Full); }
private void miAutohistoryforcards_Click(object sender, EventArgs e) { CF.SetValue(autohistoryForCards, this.miAutohistoryforcards.Checked.ToString()); }
private void HH_FormClosed(object sender, FormClosedEventArgs e) { CF.SetValue(m_KeyPrefix + m_ParentControlName, bool.TrueString); }
public void RestoreState() { try { string _videoFileName = CF.GetValue("VideoFileName", @"\Sample\Episode\video sample.mp4"); if (!Utils.IsURL(_videoFileName)) { _videoFileName = FileManager.FindPath(_videoFileName, @"Please select a video file"); } // _videoFileName = FileManager.FindPathAndReturnFullFileName(_videoFileName, @"\my_video\movie.avi - specify a file with downloaded video"); string _subtFileName = CF.GetValue("ListEn_FileName", @"\Sample\Episode\video sample.EN.srt"); //_subtFileName = FileManager.FindPath(_subtFileName, @"\my_video\subtitle_for_my_movie.sub - specify a file with downloaded subtitles"); _subtFileName = FileManager.FindPath(_subtFileName, @"Please select a video file"); string _lessonFileName = CF.GetValue("Lesson_FileName", CF.GetFolderForUserFiles() + @"\video sample.EN.srt.lesson"); string _subtNativeFileName = CF.GetValue("ListNative_FileName", @"\Sample\Episode\video sample.RU.srt"); if (string.IsNullOrEmpty(CF.GetValue(CF.installation_date, ""))) { m_IsFirstRun = true; CF.SetValue(CF.installation_date, DateTime.Today.ToString("dd-MM-yyyy")); } #region FileSelectorDialog // bool skipFileSelectorDialog = CF.GetValue("IsSkipFileSelectorDialog", false); bool skipFileSelectorDialog = false; if (!skipFileSelectorDialog && !T.NoScreen) { #region working with Args foreach (string arg in T.Args) { if (!File.Exists(arg)) { continue; } if (GlobalOptions.IsVideo(arg)) { _videoFileName = arg; // SuggestTextFile(this.VideoFileName); //break; } else if (GlobalOptions.IsSubtitle(arg) || GlobalOptions.IsText(arg)) { _subtFileName = arg; // SuggestVideoFile(this.FileName); //break; } } #endregion Type tFoo = typeof(mshtml.BlockFormats); // it's for loading mshtml assembly FileSelectorInstance = new FileSelector() { VideoFileName = _videoFileName, SubtitleFileName = _subtFileName, LessonFileName = _lessonFileName, SubtitleNativeFileName = _subtNativeFileName }; if (IsFirstRun) { FileSelectorInstance.DoUseSample(); } FileSelectorInstance.Show(); // поскольку this.Visible = false; } #endregion this.reader.TwinList.ListEn.TimeShift = CF.GetValue(CF.timeshift_video, 0.0D); this.reader.TwinList.ListEn.RefreshLabelIndent(); this.RestoreState(this.reader.TwinList.ListEn, false); // т.к. после перезапуска программы не подсвечивается текущее предложение, оно где то внизу this.reader.TwinList.ListEn.List.ScrollSelectedToCenter(); this.RestoreState(this.reader.TwinList.ListNative, string.IsNullOrEmpty(_subtNativeFileName)); if (VideoForm.CurrentVideoContrl != null) { VideoForm.CurrentVideoContrl.mainMenu1.CheckButtonsState(); } #region LanguageDirection //CurrentLangInfo.InitLanguagesMenu(this.toolStrip1); CurrentLangInfo.LanguageDirection = this.reader.LanguageDirection = CF.GetValue("LanguageDirection", CurrentLangInfo.DefaultLangDir); CurrentLangInfo.ChangedLanguageDirection += new EventHandler(ListEn_ChangeLanguageDirection); #endregion // auto ListEn_ChangeLanguageDirection(this.reader.LanguageDirection, EventArgs.Empty); // this.reader.TwinText.textEn.Font = new Font(this.reader.TwinText.textEn.Font.Name, float.Parse(CF.GetValue(sentenceList.Name + "FontSize", 9))); this.reader.TwinText.MenuForSelected.IsListenByClick = CF.GetValue("ListenByClick", true); this.reader.TwinText.MenuForSelected.IsShowPopupWindow = CF.GetValue("ShowPopupWindow", true); this.reader.TwinText.MenuForSelected.IsAddWordToTutor = CF.GetValue("AddWordToTutorOnDoubleClick", false); // --- false --- //this.reader.TwinText.menuForSelected1.miPopupAsMonoDictionary.Checked = CF.GetValue("PopupAsMonoDictionary", false); this.reader.TwinText.MenuForSelected.LastDictName = CF.GetValue("LastDictionary", GoogleDictionary.MainTitle); // http://tech.onliner.by/2012/04/12/resolution // весной 2012 года разрешение мониторов 1024×768 впервые перестало быть самым популярным среди пользователей PC, уступив пальму первенства 1366×768. // В США самым популярным разрешением пока остается 1024×768. CF.AssignValues("MainForm", this, new Point(10, 20), new Size(1200, 728)); this.reader.TwinText.Height = CF.GetValue("TextTwin", 364); // если так то хрень - // 100); // this.reader.TwinText.textForeignAndTran.paForeignText.Height = CF.GetValue("TextForeign_Heigh", 62); // this.reader.TwinText.textWithTranslate.SetAccommodativeHeight(true); // this.reader.TwinText.textNative.Width = CF.GetValue("TextNative", 250); // for TwinList this.reader.TwinList.ListNative.Width = CF.GetValue("ListNative", 252); this.reader.TwinList.paLists.Width = CF.GetValue(text_lists_width, this.Width / 2); // for TwinText this.reader.TwinText.textForeignAndTran.ForeignText.ZoomFactor = CF.GetValue("TextForeign_FontSize", 1f); //TODO this.reader.TwinText.textForeignAndTran.translatedText.ZoomFactor = CF.GetValue("TextTranslate_FontSize", 1f); this.reader.TwinText.textNative.ZoomFactor = CF.GetValue("TextNative_FontSize", 1f); this.reader.TwinText.MenuForSelected.miHideTranslation.Checked = CF.GetValue("IsHidedTranslation", false); } catch (Exception ex) { Messages.ErrorOnRestoringApp(ex); } // здесь видно неправильное положение //if (Utils.VideoForm != null && !Utils.VideoForm.IsDisposed && !Utils.VideoForm.Disposing) // CF.AssignValues("VideoForm", Utils.VideoForm); }