/// <summary> /// Ouverture d'un document /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OpenDocument(object sender, EventArgs e) { filechooser.Filter = Buildfilter() + "|All files (*.*)|*.*"; filechooser.FileName = ""; DialogResult result = filechooser.ShowDialog(); if (result != DialogResult.OK) return; string filename = Path.GetFileNameWithoutExtension(filechooser.FileName); ToolStripMenuItem viewSelected = sender as ToolStripMenuItem; IDocumentController controller = FindDocumentController(filename); if (controller == null) { controller = new DocumentController(LoadModel(filechooser.FileName)); controllers.Add(filename, controller); } controller.DocumentName = filechooser.FileName; Control view = CreateView(viewSelected, controller); AddView(view, filename); }
private void filechooser_FileOk(object sender, CancelEventArgs e) { String extension = Path.GetExtension(filechooser.FileName); if (availableSerializers[extension] == null) { MessageBox.Show("Extension inconnue"); return; } //String[] arguments = { filechooser.FileName, extension }; //Command command = new Command(MCommandType.PerformSaveAs, arguments); //ViewInfos.getCurrentViewController().ReceiveCommand(command); DocumentModel model = new DocumentModel(); DocumentController controller = new DocumentController(model, filechooser.FileName + "." + extension); }
/// <summary> /// Création d'un document vierge /// </summary> /// <param name="sender"> /// Objet à l'origine de l'appel /// </param> /// <param name="e"> /// Descripteur correspondant aux paramètres de l'opération /// </param> public void CreateDocument(object sender, EventArgs e) { DocumentModel model = new DocumentModel(); DocumentController controller = new DocumentController(model); ToolStripMenuItem viewSelected = sender as ToolStripMenuItem; Control view = CreateView(viewSelected, controller); AddView(view, "Nouveau"); }