示例#1
0
			public LookupFormFileIsInUse(LookupForm form, string path)
				: base(path)
			{
				this.form = form;
				CanClose = true;
				WindowHandle = form.Handle;
			}
示例#2
0
 private void OpenDictionaries(IList <DictionaryInfo> dicts)
 {
     foreach (var di in dicts)
     {
         LookupForm.OpenDictionary(di);
     }
 }
示例#3
0
 public LookupFormFileIsInUse(LookupForm form, string path)
     : base(path)
 {
     this.form    = form;
     CanClose     = true;
     WindowHandle = form.Handle;
 }
示例#4
0
文件: Program.cs 项目: aata/szotar
            protected override void OnCreateMainForm()
            {
                switch (GuiConfiguration.StartupAction)
                {
                case "Practice":
                    MainForm =
                        new Forms.PracticeWindow(DataStore.Database.GetSuggestedPracticeItems(GuiConfiguration.PracticeDefaultCount),
                                                 PracticeMode.Learn);
                    break;

                case "Dictionary":
                    string dict = GuiConfiguration.StartupDictionary;
                    if (string.IsNullOrEmpty(dict))
                    {
                        break;
                    }

                    Exception error = null;

                    try {
                        DictionaryInfo info = new SimpleDictionary.Info(dict);
                        MainForm = new Forms.LookupForm(info);
                    } catch (System.IO.IOException e) {
                        // TODO: Access/permission exceptions?
                        error = e;
                    } catch (DictionaryLoadException e) {
                        error = e;
                        // Maybe there should be some UI for this (it's there, but not loadable?)...
                    }

                    if (error != null)
                    {
                        ProgramLog.Default.AddMessage(LogType.Error, "Could not load dictionary {0}: {1}", dict, error.Message);
                    }
                    break;
                }

                if (MainForm == null)
                {
                    MainForm = new Forms.StartPage();
                }
            }
示例#5
0
			protected override void OnCreateMainForm() {
				switch (GuiConfiguration.StartupAction) {
					case "Practice":
						MainForm =
							new Forms.PracticeWindow(DataStore.Database.GetSuggestedPracticeItems(GuiConfiguration.PracticeDefaultCount),
							                         PracticeMode.Learn);
						break;

					case "Dictionary":
						string dict = GuiConfiguration.StartupDictionary;
						if (string.IsNullOrEmpty(dict))
							break;

						Exception error = null;

						try {
							DictionaryInfo info = new SimpleDictionary.Info(dict);
							MainForm = new Forms.LookupForm(info);
						} catch (System.IO.IOException e) {
							// TODO: Access/permission exceptions?
							error = e;
						} catch (DictionaryLoadException e) {
							error = e;
							// Maybe there should be some UI for this (it's there, but not loadable?)...
						}

						if (error != null)
							ProgramLog.Default.AddMessage(LogType.Error, "Could not load dictionary {0}: {1}", dict, error.Message);
						break;
				}

				if (MainForm == null)
					MainForm = new Forms.StartPage();
			}