Esempio n. 1
0
        private void Practice(PracticeMode mode)
        {
            if (!list.ID.HasValue)
            {
                ProgramLog.Default.AddMessage(LogType.Error, "WordList {0} has no ID", list.Name);
                return;
            }

            PracticeWindow.OpenNewSession(mode, new[] { new ListSearchResult(list.ID.Value) });
        }
Esempio n. 2
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();
                }
            }
Esempio n. 3
0
        private void PracticeLists(PracticeMode mode, IList <ListSearchResult> chosen)
        {
            var items = new List <ListSearchResult>();

            if (chosen == null || chosen.Count == 0)
            {
                return;
            }

            foreach (var item in chosen)
            {
                if (item.HasItem ||
                    items.FindIndex(x => x.SetID == item.SetID && !x.HasItem) < 0)
                {
                    items.Add(item);
                }
            }

            PracticeWindow.OpenNewSession(mode, items);
        }
Esempio n. 4
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();
			}