public void New(Graph graph) { void Open(string path) { try { GraphHelper.NewGraph(); var pxwFile = Path.Combine(path, UserSettings.Instance.ProjectFile); GraphHelper.SaveGraph(pxwFile); SaverLoader.ClearSpecFolders(Path.GetDirectoryName(pxwFile)); GraphicsWindowController.Instance.CloseGraphicsWindowIfOpened(); } catch (Exception ex) { UIManager.ShowDialog(null, ex.Message, "Ok"); Debug.LogException(ex); } } OpenFileController.Instance.OpenFolder("Select Graph Folder", "", (path) => { if (string.IsNullOrWhiteSpace(path)) { return; } var files = Directory.GetFiles(path, "*.*"); var folders = Directory.GetDirectories(path, "*.*"); if (files.Length != 0 || folders.Length != 0) { UIManager.ShowDialog(null, "Folder is not empty." + Environment.NewLine + "All files and subdirectories will be removed." + Environment.NewLine + "Are you sure to create new project here?", "Ok", "Cancel", onClosed: (res) => { Debug.Log(res); if (res == DialogResult.Ok) { Open(path); } } ); } else { Open(path); } }); }