public async Task ExecuteLoadItemsCommandAsync() { IsBusy = true; try { ListWords.Clear(); var items = await DataStore.ReadDataBase(true); items = items.Reverse(); foreach (var item in items) { ListWords.Add(item); } LastWordAdd = ListWords[0].DateTime; CountWords = ListWords.Count; OnPropertyChanged("LastWordAdd"); OnPropertyChanged("CountWords"); } finally { IsBusy = false; } }
public static void LoadSetWords(ListWords CurrentListWords, string SetName) { if (SetsWords.ContainsKey(SetName)) { CurrentListWords = SetsWords[SetName]; } CurrentListWords = null; }
public static async void InitLoadSet() { string fileContent; Uri uri = new Uri("ms-appx:///Data/Sets.txt"); file = await StorageFile.GetFileFromApplicationUriAsync(uri); StreamReader sRead = new StreamReader(await file.OpenStreamForReadAsync()); fileContent = await sRead.ReadLineAsync(); KeyValuePair<int, object> res = Type(fileContent); ListWords currentListWords = new ListWords(); while (res.Key != -1) { if (res.Key == 0) { currentListWords.Name = (string)res.Value; SetsNames.Add((string)res.Value); } if (res.Key == 1) { currentListWords.Add((Word)res.Value); } if (res.Key == 2) { SetsWords.Add(currentListWords.Name, currentListWords); currentListWords = new ListWords(); } fileContent = sRead.ReadLineAsync().Result; res = Type(fileContent); } MainPage.CurrentListWords = SetsWords["None"]; sRead.Dispose(); }
private void GetListWords(List <Word> words) { ListWords.AddRange(words); ListWords = ListWords.Distinct(new WordComparer()).ToList(); foreach (Word w in ListWords) { w.IsWordAccepted(ListStates, ListTransitions); } }
// Method // Load All Words public async Task LoadListWords() { if (_lstWord.LstKey.Count != 0) { _lstWord.LstKey.Clear(); _lstWord.LstLength.Clear(); _lstWord.LstOffset.Clear(); } _lstWord = await DataHelper.LoadListWords(); }
static ListWords Words(string temp) { string[] word = temp.Split(new char[] { ' ', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); ListWords list = new ListWords(); for (int i = 0; i < word.Length; i++) { list.ShapeList(word[i]); } return(list); }
private void initListWords() { ListWords listw = new ListWords(); list = listw.Words; listVoice_lbx.Items.Clear(); foreach (KeyValuePair <string, string> key in list) { listVoice_lbx.Items.Add(key.Key); listVoice2_lbx.Items.Add(key.Key); } }
public void CreateTextFile() { ListWords = ListWords.Distinct(new WordComparer()).ToList(); string content = ""; content += $"# {Comment}" + Environment.NewLine + Environment.NewLine; content += $"alphabet: {String.Join("", ListAlphabets)}" + Environment.NewLine; content += $"stack: {String.Join("", ListStacks)}" + Environment.NewLine; content += $"states: {String.Join(",", ListStates)}" + Environment.NewLine; content += $"final: {String.Join(",", ListStates.FindAll(x => x.IsFinal))}" + Environment.NewLine + Environment.NewLine; content += $"transitions:" + Environment.NewLine; content += $"{String.Join(Environment.NewLine, ListTransitions)}" + Environment.NewLine; content += "end." + Environment.NewLine + Environment.NewLine; content += "dfa: "; if (IsDFA) { content += "y" + Environment.NewLine; } else { content += "n" + Environment.NewLine; } content += "finite: "; if (IsFinite) { content += "y" + Environment.NewLine; } else { content += "n" + Environment.NewLine; } content += Environment.NewLine; content += $"words:" + Environment.NewLine; foreach (Word word in ListWords) { if (word.IsAccepted) { content += word.Words + ",y" + Environment.NewLine; } else { content += word.Words + ",n" + Environment.NewLine; } } content += "end."; string file_name = "automaton_" + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".txt"; File.WriteAllText(file_name, content); }
private bool CheckIsFinite() { words = new List <string>(); hasLoop = false; List <State> initial_States = ListStates.FindAll(x => x.IsInitial); foreach (var initial in initial_States) { List <Transition> used_transitions = new List <Transition>(); bool hasloop = false; GetWord(initial, used_transitions, hasloop); } if (hasLoop) { return(false); } foreach (var item in words) { ListWords.Add(new Word(item)); } return(true); }
private async Task <ListWords> LoadListWordsAsync() { if (_lstWords == null) { _lstWords = new ListWords(); } if (_lstWords.LstKey.Count != 0 && !App.ChangeDict) { return(_lstWords); } string result = null; string path = @"ms-appx:///Data/" + App.TypeDictIns.GetTypeDict() + "/" + fileInd; StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri(path)); using (StreamReader sRead = new StreamReader(await file.OpenStreamForReadAsync())) result = await sRead.ReadToEndAsync(); string[] lines = result.Split(new char[1] { '\n' }); foreach (string line in lines) { string[] strs = line.Split(new char[1] { '\t' }); _lstWords.LstKey.Add(strs[0]); _lstWords.LstOffset.Add(strs[1]); _lstWords.LstLength.Add(strs[2]); } App.ChangeDict = false; return(_lstWords); }
public Dict() { _lstWord = new ListWords(); _lstTranslatedWords = new List <string>(); _lstFavoriteWords = new List <string>(); }