public void OpenProgram(string fullpath) { var openedProgram = OpenedDocuments.FirstOrDefault(op => op.ProgramFullPath == fullpath); if (openedProgram != null) { DocumentOpened?.Invoke(this, new DocumentOpenEventArgs(openedProgram)); return; } var programforOpening = RecentPrograms.FirstOrDefault(p => p.ProgramFullPath == fullpath); if (programforOpening == null) { programforOpening = ProgramViewModel.Create(fullpath, this, TvcStudioSettings); RecentPrograms.Add(programforOpening); } if (programforOpening.ProgramState == ProgramState.NotFound) { TraceEngine.TraceError($"{programforOpening.ProgramFullPath} beolvasása sikertelen, a file nem található!"); return; } openedProgram = programforOpening.GetDocumentViewModel(); openedProgram.DocumentClosedEvent += OnDocumentClose; OpenedDocuments.Add(openedProgram); programforOpening.ProgramState = ProgramState.Opened; DocumentOpened?.Invoke(this, new DocumentOpenEventArgs(openedProgram)); }
public void OpenReadonlyDocument(string fullPath) { var openedProgram = OpenedDocuments.FirstOrDefault(op => op.ProgramFullPath == fullPath); if (openedProgram != null) { DocumentOpened?.Invoke(this, new DocumentOpenEventArgs(openedProgram)); return; } openedProgram = new ReadOnlyDocumentViewModel(fullPath, TvcStudioSettings); openedProgram.DocumentClosedEvent += OnDocumentClose; OpenedDocuments.Add(openedProgram); DocumentOpened?.Invoke(this, new DocumentOpenEventArgs(openedProgram)); }