private void newToolStripMenuItem_Click(object sender, EventArgs e) { NewForm lForm = new NewForm(this); if (lForm.ShowDialog() == DialogResult.OK) { //===================================================================== // Load the file from the CD image //===================================================================== CDImage lCDImage = new CDImage(new FileInfo(lForm.CDImageTextBox.Text)); MMCD.Course lCourse = (MMCD.Course)lForm.CourseDropDown.SelectedItem; byte[] lLevelBinary = lCDImage.Extract(lCourse.CDOffset, lCourse.CDLength); MemoryStream lLevelStream = new MemoryStream(lLevelBinary); Level lNewLevel = new Level(lLevelStream); //===================================================================== // Check that the whole file has been read //===================================================================== if (lLevelStream.Length != lLevelStream.Position) { throw new DeserialisationException(string.Format("Deserialisation terminated early at byte {0} of {1}", lLevelStream.Position, lLevelStream.Length)); } //===================================================================== // Create a new VersionList based on this level, and set it up //===================================================================== VersionList lVersionList = new VersionList(lNewLevel, lCourse.CourseName, lCourse.FileName); RootChunk = lVersionList; mCurrentFile = null; } }
protected virtual void Command() { INewForm rf = new NewForm(); if (rf.ShowDialog() == DialogResult.OK) { var newItem = new DemoPage() { TextX = rf.NewName, }; _collection.Add(rf.NewName, newItem, null); } }
private void Command() { INewForm rf = new NewForm(); rf.Types = Enum.GetNames(typeof(ToolTypes)); rf.SelectedType = ToolTypes.CAN; if (rf.ShowDialog() == DialogResult.OK) { if (_table.FirstOrDefault(n => n.Name == rf.NewName) != null) { MessageBox.Show(CultureService.Instance.GetString(CultureText.text_AlreadyExists), Application.CompanyName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (string.IsNullOrWhiteSpace(rf.NewName) || string.IsNullOrEmpty(rf.NewName)) { MessageBox.Show(CultureService.Instance.GetString(CultureText.text_TheFieldCantBeEmtpy), Application.CompanyName, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { _table.Add(new ToolTableItem(rf.NewName, rf.SelectedType)); } } }