static void Main(string[] args) { SaveText <int, string> St = new SaveText <int, string>(); Serialize <int, string> sb = new Serialize <int, string>(); if (St.Save(sb)) { Console.WriteLine(St.Read()); } Console.ReadKey(); }
private void Notepad_FormClosing(object sender, FormClosingEventArgs e) { Properties.Settings.Default.TextColorSave = NotepadText.ForeColor; Properties.Settings.Default.BackColorSave = NotepadText.BackColor; Properties.Settings.Default.TextFontSave = NotepadText.Font; Properties.Settings.Default.AppSizeSave = this.Size; Properties.Settings.Default.WordWrapSave = NotepadText.WordWrap; Properties.Settings.Default.TextWordSave = WordWrap.Text; Properties.Settings.Default.Save(); if (NotepadText.Text.Length != 0) { DialogResult s = MessageBox.Show("Do You Want Save File?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (s == DialogResult.Yes) { SaveText.Filter = "All(*.mash)|*.mash"; SaveText.ShowDialog(); } } }
private void NewFile_Click(object sender, EventArgs e) { if (NotepadText.Text.Length == 0) { NotepadText.Text = ""; } else { DialogResult s = MessageBox.Show("Do You Want Save File?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (s == DialogResult.Yes) { SaveText.Filter = "All(*.mash)|*.mash"; SaveText.ShowDialog(); NotepadText.Text = ""; } else { NotepadText.Text = ""; } } }
/// <summary> /// Save all the downloaded element of a route to the device disk /// </summary> /// <param name="bf">to format the element</param> /// <param name="rootPath">root folder path to save the element</param> /// <returns>to wait for the end of the download</returns> private IEnumerator SaveElement(BinaryFormatter bf, string rootPath) { while (download.toDownload.Count > 0 || download.isWorking) { yield return new WaitForSeconds(0.1f); } foreach (ArObject a in data.arObjects.Values) { if (a.GetComponent<TextMesh>() != null) { SaveText s = new SaveText(a.GetComponent<TextMesh>().text); SaveToDisk(s, rootPath + Data.textPath + a.id + ".dat", bf); } else if (a.GetComponent<MtlImporter>() != null) { SaveObject3D s = new SaveObject3D(a.GetComponent<MtlImporter>()); SaveToDisk(s, rootPath + Data.objPath + a.id + ".dat", bf); } else if (a.GetComponent<MeshRenderer>() != null) { SaveImage s = new SaveImage(a.GetComponent<MeshRenderer>().material.mainTexture, a.transform); SaveToDisk(s, rootPath + Data.imagePath + a.id + ".dat", bf); } } foreach (KeyValuePair<string, string> p in data.mtl) { SaveToDisk(p.Value, rootPath + Data.mtlPath + p.Key + ".dat", bf); } foreach (KeyValuePair<string, Texture2D> p in data.textures) { SaveToDisk(p.Value.EncodeToPNG(), rootPath + Data.texturePath + p.Key + ".dat", bf); } data.DeleteArElement(); ToolBox.Instance.loadingScreen.enable(false); }
public NoteListViewModel(IPageService pageService) { _pageService = pageService; GetData(); EraseCommand = new Command(() => { Note = string.Empty; }); AddTaskCommand = new Command((parameter) => { _pageService.PushAsync(new NoteEntryPage() { BindingContext = this }); }); SaveCommand = new Command(async(parameter) => { if (SaveText.Equals("Save")) { Note note = new Note() { Text = Note, Date = DateTime.Now }; Notes.Add(note); await App.Database.SaveNoteAsync(note); Note = string.Empty; } else if (SelectedNote != null) { int currentIndex = Notes.IndexOf(SelectedNote); Notes.Remove(SelectedNote); Note note = new Note() { Text = Note, Date = DateTime.Now, ID = SelectedNote.ID }; await App.Database.SaveNoteAsync(note); Notes.Insert(currentIndex, note); SelectedNote = null; Note = string.Empty; SaveText = "Save"; } _pageService.PopAsync(); }); SelectionChangedCommand = new Command(async() => { var detailVM = new DetailPageViewModel(SelectedNote); var detailView = new DetailPage(); detailView.BindingContext = detailVM; await Application.Current.MainPage.Navigation.PushAsync(detailView); }); DeleteCommand = new Command(async(parameter) => { if (parameter != null) { Note currentNote = (parameter as Note); SelectedNote = currentNote; Notes.Remove(currentNote); await App.Database.DeleteNoteAsync(currentNote); } }); EditCommand = new Command((parameter) => { if (parameter != null) { Note currentNote = (parameter as Note); SelectedNote = currentNote; Note = currentNote.Text; SaveText = "Update"; _pageService.PushAsync(new NoteEntryPage() { BindingContext = this }); } }); SearchCommand = new Command((parameter) => { var textchanged = parameter as TextChangedEventArgs; if (textchanged != null) { Notes.Clear(); foreach (var note in _notesList.Where(i => i.Text.StartsWith(textchanged.NewTextValue))) { Notes.Add(note); } } }); }
private void SaveAs_Click(object sender, EventArgs e) { SaveText.Filter = "All(*.mash)|*.mash"; SaveText.ShowDialog(); }