private static void ImportCsv( IWin32Window owner, string filePath, NotebookManager manager, DatabaseSchema schema ) { using ImportCsvForm f = new(filePath, schema, manager); f.ShowDialog(owner); }
/// <summary> /// Exports all notes to a given folder. /// </summary> /// <param name="output_folder"> The folder that the notes will be exported to. </param> private void ExportAllNotes(string output_folder) { Logger.Debug("Creating an export folder in: " + output_folder); System.IO.Directory.CreateDirectory(output_folder); //Iterate through notebooks Notebooks.Notebook notebook; string notebook_folder; foreach (Tag tag in TagManager.AllTags) { // Skip over tags that aren't notebooks notebook = NotebookManager.GetNotebookFromTag(tag); if (notebook == null) { continue; } Logger.Debug("Exporting notebook " + notebook.Name); notebook_folder = SanitizePath(output_folder + System.IO.Path.DirectorySeparatorChar + notebook.NormalizedName); System.IO.Directory.CreateDirectory(notebook_folder); ExportNotesInList(notebook.Tag.Notes, notebook_folder); } //Finally we have to export all unfiled notes. Logger.Debug("Exporting Unfiled Notes"); ExportNotesInList(ListUnfiledNotes(), output_folder); }
private void Awake() { prefabManager = GetComponent <PrefabManager>(); menuManager = GetComponent <MenuManager>(); sceneLoader = GetComponent <SceneLoader>(); charactersCommon = GetComponent <CharactersCommon>(); spawnCharacter = GetComponent <SpawnCharacter>(); pauseManager = GetComponent <PauseManager>(); levelMessageManager = GetComponent <LevelMessageManager>(); tutorialMessageManager = GetComponent <TutorialMessageManager>(); menuMessageManager = GetComponent <MenuMessageManager>(); threatManager = GetComponent <ThreatManager>(); timeEventManager = GetComponent <TimeEventManager>(); timeManager = GetComponent <TimeManager>(); cameraManager = GetComponent <CameraManager>(); notebookManager = GetComponent <NotebookManager>(); dialogBoxManager = GetComponent <DialogBoxManager>(); tutorialDialogBoxManager = GetComponent <TutorialDialogBoxManager>(); idCardManager = GetComponent <IdCardManager>(); gameDataManager = GetComponent <GameDataManager>(); threatChartManager = GetComponent <ThreatChartManager>(); logManager = GetComponent <LogManager>(); userActionManager = GetComponent <UserActionManager>(); if (SceneManager.GetActiveScene().buildIndex == StaticDb.menuSceneIndex || SceneManager.GetActiveScene().buildIndex == StaticDb.loginSceneIndex) { return; } regularPathfinder = GameObject.Find("PathFinderRegular").GetComponent <Pathfinding>(); strictedPathfinder = GameObject.Find("PathFinderRestricted").GetComponent <Pathfinding>(); }
public static void Start(IWin32Window owner, string filePath, NotebookManager manager) { var schema = ReadDatabaseSchema(owner, manager); if (schema == null) { return; } var extension = Path.GetExtension(filePath).ToLowerInvariant(); switch (extension) { case ".csv": case ".tsv": case ".txt": ImportCsv(owner, filePath, manager, schema); break; case ".xls": case ".xlsx": case ".xlsm": case ".xlsb": ImportXls(owner, filePath, manager, schema); break; default: throw new InvalidOperationException($"The file type \"{extension}\" is not supported."); } }
// Start is called before the first frame update void Start() { backpackBackground.SetActive(false); backpackSlots.SetActive(false); player = GameObject.Find("Player"); notebook = GetComponent <NotebookManager>(); }
private static DatabaseSchema ReadDatabaseSchema(IWin32Window owner, NotebookManager manager) { var schema = WaitForm.Go(owner, "Import", "Reading notebook...", out var success, () => DatabaseSchema.FromNotebook(manager.Notebook)); if (!success) { return(null); } return(schema); }
public QueryBlockControl(NotebookManager manager) { _manager = manager; _hover.Click += Hover_Click; ResizeRedraw = true; Cursor = Cursors.Hand; this.EnableDoubleBuffering(); UserOptions.OnUpdate(this, Invalidate); Disposed += delegate { Output?.Dispose(); }; }
void Awake() //Makes this a singleton class on awake { if (instance == null) //Does an instance already exist? { instance = this; //If not set instance to this } else if (instance != this) //If it already exists and is not this then destroy this { Destroy(gameObject); } DontDestroyOnLoad(gameObject); //Set this to not be destroyed when reloading scene }
public ExportForm(NotebookManager manager) { InitializeComponent(); _manager = manager; using var g = CreateGraphics(); var scripts = _manager.Items.Where(x => x.Type == NotebookItemType.Script).Select(x => x.Name); var tables = _manager.Items.Where(x => x.Type == NotebookItemType.Table).Select(x => x.Name); var views = _manager.Items.Where(x => x.Type == NotebookItemType.View).Select(x => x.Name); Ui ui = new(this, 75, 25); ui.Init(_table); ui.Init(_helpLabel); ui.Init(_list); ui.MarginTop(_list); ui.Init(_buttonFlow); ui.MarginTop(_buttonFlow); ui.Init(_exportButton); ui.Init(_cancelButton); ImageList imageList = new() { ColorDepth = ColorDepth.Depth32Bit, ImageSize = new(this.Scaled(16), this.Scaled(16)), }; imageList.Images.Add(Ui.GetScaledIcon(this, Resources.script, Ui.ShiftImage(Resources.script32, 0, 1), dispose: false)); imageList.Images.Add(Ui.GetScaledIcon(this, Resources.table, Resources.table32, dispose: false)); imageList.Images.Add(Ui.GetScaledIcon(this, Resources.filter, Resources.filter32, dispose: false)); _list.SmallImageList = imageList; foreach (var name in scripts) { var lvi = _list.Items.Add(name); lvi.ImageIndex = 0; lvi.Group = _list.Groups[0]; } foreach (var name in tables) { var lvi = _list.Items.Add(name); lvi.ImageIndex = 1; lvi.Group = _list.Groups[1]; } foreach (var name in views) { var lvi = _list.Items.Add(name); lvi.ImageIndex = 2; lvi.Group = _list.Groups[2]; } _list.Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent); }
public QueryDocumentControl(string name, NotebookManager manager, IWin32Window mainForm) { InitializeComponent(); ItemName = name; _manager = manager; var record = _manager.GetItemData(ItemName) as ScriptNotebookItemRecord; _queryControl = new(manager, isPageContext : false, initialText : record?.Sql ?? ""); _queryControl.Dock = DockStyle.Fill; _queryControl.TextControl.SqlTextChanged += (sender2, e2) => _manager.SetDirty(); Controls.Add(_queryControl); }
/// <summary> /// Finds all notes without a notebook tag and returns them in a list. /// </summary> public List <Note> ListUnfiledNotes() { List <Note> unfiled_notes = new List <Note> (); //Checks all notes foreach (Note note in Tomboy.DefaultNoteManager.Notes) { if (NotebookManager.GetNotebookFromNote(note) == null) { unfiled_notes.Add(note); } } return(unfiled_notes); }
public bool AddNotebook(string notebook_name) { if (NotebookManager.GetNotebook(notebook_name) != null) { return(false); } Notebook notebook = NotebookManager.GetOrCreateNotebook(notebook_name); if (notebook == null) { return(false); } return(true); }
private static void ImportXls( IWin32Window owner, string filePath, NotebookManager manager, DatabaseSchema schema ) { var input = WaitForm.Go(owner, "Import", "Reading workbook...", out var success, () => XlsInput.Load(filePath)); if (!success) { return; } using ImportXlsForm f = new(input, manager, schema); f.ShowDialog(owner); }
public TableDocumentControl(NotebookManager manager, string tableName) { InitializeComponent(); _manager = manager; _tableName = tableName; _toolStrip.SetMenuAppearance(); _grid = DataGridViewUtil.NewDataGridView(contextMenu: true); _grid.Dock = DockStyle.Fill; _tablePanel.Controls.Add(_grid); Ui ui = new(this, false); ui.Init(_scriptBtn, Resources.script_go, Resources.script_go32); }
public TrackingService() { context = AgregateContext.Of(EventLogContext.Current, this); try { notebookManager = new NotebookManager(DataSourceFactory.Create(DataSourceType.Local)); } catch (Exception e) { InformationDispatcher.Default.Dispatch(e, context); } //ExceptionUtils.LogExceptions(() => notebookManager = new NotebookManager(DataSourceFactory.Create(DataSourceType.Local)), context); }
public AppExtension() { connection = new ClientConnection(); connection.ConnectionClosed += (sender, args) => { Connected = false; }; historyProvider = new NotebookHistoryProvider(null); tracking = new TrackingSystem(); notebooks = new NotebookManager(null); history = new HistoryManager(); credentialsManager = new AuthenticationManager(null); InitializeNotebooks(); InitializeTracking(); InitializeHistory(); }
public string GetNotebookForNote(string uri) { Note note = note_manager.FindByUri(uri); if (note == null) { return(string.Empty); } Notebook notebook = NotebookManager.GetNotebookFromNote(note); if (notebook == null) { return(string.Empty); } return(notebook.Name); }
public ConsoleControl(IWin32Window mainForm, NotebookManager manager) { InitializeComponent(); _mainForm = mainForm; _manager = manager; _inputText = new(false) { Dock = DockStyle.Fill }; _inputText.SetVerticalScrollbarVisibility(SqlTextControl.ScrollbarVisibility.Auto); _inputText.F5KeyPress += InputText_F5KeyPress; _inputPanel.Controls.Add(_inputText); _outputFlow = new() { AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, FlowDirection = FlowDirection.TopDown }; _outputPanel.Controls.Add(_outputFlow); Ui ui = new(this, false); ui.Init(_table); ui.Init(_executeButton, Resources.ControlPlayBlue, Resources.control_play_blue32); _executeButton.Margin = Padding.Empty; _table.RowStyles[1].Height = ui.XHeight(4); _inputBorderPanel.Margin = new(0, ui.XHeight(0.2), 0, 0); _outputSqlMargin = new(ui.XWidth(1), ui.XHeight(0.5), ui.XWidth(1), ui.XHeight(0.75)); _outputTableMargin = new(ui.XWidth(8), 0, ui.XWidth(1), ui.XHeight(0.75)); _outputCountMargin = new(ui.XWidth(8), 0, 0, 0); _spacerSize = new(0, ui.XHeight(1)); _contextMenuStrip.SetMenuAppearance(); ui.Init(_clearHistoryMenu, Resources.Delete, Resources.delete32); _outputFlow.ContextMenuStrip = _contextMenuStrip; _outputPanel.ContextMenuStrip = _contextMenuStrip; void OptionsUpdated() { var opt = UserOptions.Instance; _outputPanel.BackColor = opt.GetColors()[UserOptionsColor.GRID_BACKGROUND]; }; OptionsUpdated(); UserOptions.OnUpdate(this, OptionsUpdated); }
public static void TestSomething() { NotebookManager top = GlobalVariables.traindir.m_frame.m_top; int id = top.FindPage("Layout"); PaintDC dc = new PaintDC(top.GetPage(id)); // dc.Font = font; // dc.TextForeground = textColour; dc.BackgroundMode = DCBackgroundMode.TRANSPARENT; dc.BackgroundMode = DCBackgroundMode.SOLID; dc.Background = new Brush(new Colour(0x80, 0, 0)); dc.Clear(); dc.DrawText("wxWidgets common dialogs test application", 10, 10); dc.Dispose(); //needed }
public bool AddNoteToNotebook(string uri, string notebook_name) { if (note_manager.ReadOnly) { return(false); } Note note = note_manager.FindByUri(uri); if (note == null) { return(false); } Notebook notebook = NotebookManager.GetNotebook(notebook_name); if (notebook == null) { return(false); } return(NotebookManager.MoveNoteToNotebook(note, notebook)); }
public ImportCsvForm(string filePath, DatabaseSchema schema, NotebookManager manager) { InitializeComponent(); _filePath = filePath; _databaseSchema = schema; _manager = manager; _optionsControl = new ImportCsvOptionsControl(schema) { AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink }; _optionsPanel.Controls.Add(_optionsControl); _columnsControl = new ImportColumnsControl(allowDetectTypes: true) { Dock = DockStyle.Fill }; _columnsLoadControl = new LoadingContainerControl { ContainedControl = _columnsControl, Dock = DockStyle.Fill }; _columnsPanel.Controls.Add(_columnsLoadControl); _inputPreviewControl = new ImportCsvPreviewControl { Dock = DockStyle.Fill }; _inputPreviewLoadControl = new LoadingContainerControl { ContainedControl = _inputPreviewControl, Dock = DockStyle.Fill }; _originalFilePanel.Controls.Add(_inputPreviewLoadControl); Ui ui = new(this, 170, 45); ui.Init(_table); ui.Init(_outerSplit, 0.48); ui.InitHeader(_originalFileLabel); ui.Init(_lowerSplit, 0.52); ui.InitHeader(_optionsLabel); ui.InitHeader(_columnsLabel); ui.Init(_buttonFlow1); ui.MarginTop(_buttonFlow1); ui.Init(_previewButton); ui.Init(_buttonFlow2); ui.MarginTop(_buttonFlow2); ui.Init(_okBtn); ui.Init(_cancelBtn); Load += async(sender, e) => { ValidateOptions(); await UpdateControls(inputChange : true); _optionsControl.SelectTableCombo(); }; var o = _optionsControl; Bind.OnChange(new Slot[] { o.TargetTableName }, async(sender, e) => { ValidateOptions(); await UpdateControls(columnsChange: true); }); Bind.OnChange(new Slot[] { o.FileEncoding }, async(sender, e) => await UpdateControls(inputChange: true)); Bind.OnChange(new Slot[] { o.IfTableExists, o.SkipLines, o.HasColumnHeaders, o.Separator }, async(sender, e) => await UpdateControls(columnsChange: true)); Bind.BindAny(new[] { _columnsLoadControl.IsOverlayVisible, _inputPreviewLoadControl.IsOverlayVisible }, x => _okBtn.Enabled = !x); Text = $"Import {Path.GetFileName(_filePath)}"; o.TargetTableName.Value = Path.GetFileNameWithoutExtension(_filePath); }
/// <summary> /// Called when the user chooses "Export All" /// </summary> /// <param name="sender"> void ExportAllNotes() { Logger.Info("Activated export all to " + export_type_pretty_name); exporting_single_notebook = false; //Opens the folder selection dialog ExportMultipleDialog dialog = new ExportMultipleDialog(String.Format(Catalog.GetString("All Notes {0} Export"), export_type_pretty_name), export_type_pretty_name); int response = dialog.Run(); if (response != (int)Gtk.ResponseType.Ok) { Logger.Debug("User clicked cancel."); dialog.Destroy(); return; } string output_folder = SanitizePath(dialog.Filename); try { Logger.Debug("Creating an export folder in: " + output_folder); System.IO.Directory.CreateDirectory(output_folder); //Iterate through notebooks Notebooks.Notebook notebook; string notebook_folder; foreach (Tag tag in TagManager.AllTags) { // Skip over tags that aren't notebooks notebook = NotebookManager.GetNotebookFromTag(tag); if (notebook == null) { continue; } Logger.Debug("Exporting notebook " + notebook.Name); notebook_folder = SanitizePath(output_folder + System.IO.Path.DirectorySeparatorChar + notebook.NormalizedName); System.IO.Directory.CreateDirectory(notebook_folder); ExportNotesInList(notebook.Tag.Notes, notebook_folder); } //Finally we have to export all unfiled notes. Logger.Debug("Exporting Unfiled Notes"); ExportNotesInList(ListUnfiledNotes(), output_folder); //Successful export: clean up and inform. dialog.SavePreferences(); ShowSuccessDialog(output_folder); } catch (UnauthorizedAccessException) { Logger.Error(Catalog.GetString("Could not export, access denied.")); ShowErrorDialog(output_folder, dialog, Catalog.GetString("Access denied.")); return; } catch (DirectoryNotFoundException) { Logger.Error(Catalog.GetString("Could not export, folder does not exist.")); ShowErrorDialog(output_folder, dialog, Catalog.GetString("Folder does not exist.")); return; } catch (Exception ex) { Logger.Error(Catalog.GetString("Could not export: {0}"), ex); ShowErrorDialog(output_folder, dialog, Catalog.GetString("Unknown error.")); return; } finally { if (dialog != null) { dialog.Destroy(); dialog = null; } } }
public DatabaseImporter(NotebookManager manager, IWin32Window owner) { _manager = manager; _owner = owner; }
} // the ultimate result of this form public ImportXlsBookForm(string filePath, DatabaseSchema schema, NotebookManager manager) { InitializeComponent(); _filePath = filePath; _databaseSchema = schema; _manager = manager; _dockPanel = DockPanelUtil.CreateDockPanel(showWindowListButton: true); _dockPanel.DockTopPortion = 150; _dockPanelContainer.Controls.Add(_dockPanel); Text = $"Import {Path.GetFileName(filePath)}"; // left pane - sheet names { _sheetsControl = new ImportXlsSheetsControl(); _sheetsControl.ValueChanged += SheetsControl_ValueChanged; _sheetsLoadControl = new LoadingContainerControl { ContainedControl = _sheetsControl }; var dc = new UserControlDockContent("Worksheets", _sheetsLoadControl, DockAreas.DockTop) { CloseButtonVisible = false }; dc.Show(_dockPanel, DockState.DockTop); } // import script panel { _sqlControl = new SqlTextControl(readOnly: true); _sqlLoadControl = new LoadingContainerControl { ContainedControl = _sqlControl }; _sqlDockContent = new UserControlDockContent("Import Script", _sqlLoadControl) { CloseButton = false, CloseButtonVisible = false, ControlBox = false, Icon = Properties.Resources.ScriptIco }; } // import preview panel { _outputPreviewControl = new ImportMultiTablePreviewControl(); _outputPreviewControl.GeneratePreview += OutputPreviewControl_GeneratePreview; _outputPreviewLoadControl = new LoadingContainerControl { ContainedControl = _outputPreviewControl }; _outputPreviewDockContent = new UserControlDockContent("Preview", _outputPreviewLoadControl) { CloseButton = false, CloseButtonVisible = false, ControlBox = false, Icon = Properties.Resources.TableImportIco }; } // dummy panel shown while loading worksheet tabs { _sheetInitialLoadControl = new LoadingContainerControl { ContainedControl = new Panel() }; var dc = new UserControlDockContent("Loading...", _sheetInitialLoadControl) { CloseButton = false, CloseButtonVisible = false, ControlBox = false, Icon = Properties.Resources.TableSheetIco }; dc.Show(_dockPanel); _sheetInitialLoadDockContent = dc; } }
public DatabaseImportTablesForm(NotebookManager manager, IImportSession session) { InitializeComponent(); _manager = manager; _session = session; _dataTable = GetTables(session); // Source grid _srcGrid = DataGridViewUtil.NewDataGridView( autoGenerateColumns: false, allowSort: false, userColors: false, columnHeadersVisible: false); _srcGrid.Dock = DockStyle.Fill; _srcGrid.CellBorderStyle = DataGridViewCellBorderStyle.None; _srcGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _srcPanel.Controls.Add(_srcGrid); DataGridViewTextBoxColumn srcNameColumn = new() { AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, DataPropertyName = "display_name" }; _srcGrid.Columns.Add(srcNameColumn); _srcView = _dataTable.AsDataView(); _srcView.RowFilter = "to_be_imported = 0"; _srcView.Sort = "display_name"; _srcGrid.DataSource = _srcView; _srcGrid.SelectionChanged += SrcGrid_SelectionChanged; // Destination grid _dstGrid = DataGridViewUtil.NewDataGridView( autoGenerateColumns: false, allowSort: false, userColors: false, columnHeadersVisible: false); _dstGrid.Dock = DockStyle.Fill; _dstGrid.CellBorderStyle = DataGridViewCellBorderStyle.None; _dstGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; _dstPanel.Controls.Add(_dstGrid); DataGridViewTextBoxColumn dstColumn = new() { AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill, DataPropertyName = "display_name" }; _dstGrid.Columns.Add(dstColumn); var dstView = _dataTable.AsDataView(); dstView.RowFilter = "to_be_imported = 1"; dstView.Sort = "display_name"; _dstGrid.DataSource = dstView; _dstGrid.SelectionChanged += DstGrid_SelectionChanged; EnableDisableButtons(); Ui ui = new(this, 140, 35); ui.Init(_selectionTable); ui.InitHeader(_srcLabel); ui.Init(_srcToolStrip); ui.Init(_addQueryButton, Ui.SuperimposePlusSymbol(Resources.table), Ui.SuperimposePlusSymbol(Resources.table32)); ui.MarginRight(_addQueryButton); ui.Init(_srcFilterText); _srcFilterText.TextBox.SetCueText("Search"); ui.Init(_srcFilterClearButton, Resources.filter_clear, Resources.filter_clear32); ui.Init(_srcPanel); ui.InitHeader(_middleLabel); ui.Init(_selectionButtonsFlow); ui.Pad(_selectionButtonsFlow); ui.Init(_addButton); ui.Init(_removeButton); _addButton.AutoSize = false; _addButton.Size = _removeButton.Size; ui.InitHeader(_dstLabel); ui.Init(_dstToolStrip); ui.Init(_editTableButton, Resources.table_edit, Resources.table_edit32); ui.Init(_dstPanel); ui.InitHeader(_methodLabel); ui.MarginTop(_methodLabel); ui.Init(_methodFlow); ui.Pad(_methodFlow); ui.Init(_methodCopyRad); ui.Init(_methodLinkRad); ui.Init(_buttonFlow2); ui.MarginTop(_buttonFlow2); ui.Init(_viewSqlButton); ui.Init(_buttonFlow); ui.MarginTop(_buttonFlow); ui.Init(_okBtn); ui.Init(_cancelBtn); } private void DstGrid_SelectionChanged(object sender, EventArgs e) { _editTableButton.Enabled = _dstGrid.SelectedRows.Count == 1;; _removeButton.Enabled = _dstGrid.SelectedRows.Count > 0; }
/// <summary> /// Determines the relative path between two exported files, can optionally be used /// by the subclass. /// </summary> /// <param name="title_from"> /// The note we're finding the relative path from. /// </param> /// <param name="title_to"> /// The title of the note we're finding the relative path to. /// </param> /// <returns> /// A <see cref="System.String"/> /// </returns> public string ResolveRelativePath(Note note_from, string title_to) { NoteManager manager = Tomboy.DefaultNoteManager; Note note_to = manager.Find(title_to); string title_from = SanitizeNoteTitle(note_from.Title); if (note_to != null) { title_to = SanitizeNoteTitle(note_to.Title); Logger.Debug("Found linked note '{0}', sanitized title: '{1}'", note_to.Title, title_to); } else { Logger.Error("Could not find note titled '{0}' to construct a link to it", title_to); return(""); } if (exporting_single_notebook) { //If there is only one notebook being exported if (NotebookManager.GetNotebookFromNote(note_from) == NotebookManager.GetNotebookFromNote(note_to)) { return(title_to + "." + export_file_suffix); } else { return(""); } } else { //If all notebooks are available if (NotebookManager.GetNotebookFromNote(note_from) == NotebookManager.GetNotebookFromNote(note_to)) { //Both notes are in the same notebook return(title_to + "." + export_file_suffix); } else { //Unfiled notes are a special case because they're in the root directory and will // throw an exception from the notebookmanager string notebook_from; string notebook_to; try { notebook_from = NotebookManager.GetNotebookFromNote(note_from).NormalizedName; } catch (Exception ex) { notebook_from = "___NotebookManager___UnfiledNotes__Notebook___"; //TODO: Ugly! } try { notebook_to = NotebookManager.GetNotebookFromNote(note_to).NormalizedName; } catch (Exception ex) { notebook_to = "___NotebookManager___UnfiledNotes__Notebook___"; } if (notebook_to == "___NotebookManager___UnfiledNotes__Notebook___") { return(".." + System.IO.Path.DirectorySeparatorChar + title_to + "." + export_file_suffix); } else if (notebook_from == "___NotebookManager___UnfiledNotes__Notebook___") { return(SanitizePath(notebook_to) + System.IO.Path.DirectorySeparatorChar + title_to + "." + export_file_suffix); } else { return(".." + System.IO.Path.DirectorySeparatorChar + SanitizePath(notebook_to) + System.IO.Path.DirectorySeparatorChar + title_to + "." + export_file_suffix); } } } }
public ExplorerControl(NotebookManager manager, IWin32Window mainForm) { InitializeComponent(); _mainForm = mainForm; _manager = manager; _manager.NotebookChange += (sender, e) => HandleNotebookChange(e); _contextMenuStrip.SetMenuAppearance(); _toolStrip.SetMenuAppearance(); _toolStrip.Padding = new(this.Scaled(1), 0, 0, 0); _toolStrip.BackColor = SystemColors.Window; ImageList imageList = new() { ColorDepth = ColorDepth.Depth32Bit, ImageSize = new(this.Scaled(16), this.Scaled(16)), }; // Same order as the ICON_* constants. // ICON_PAGE imageList.Images.Add(Ui.GetScaledIcon(this, Resources.page, Resources.page32, dispose: false)); // ICON_SCRIPT imageList.Images.Add(Ui.GetScaledIcon(this, Resources.script, Ui.ShiftImage(Resources.script32, 0, 1), dispose: false)); // ICON_TABLE imageList.Images.Add(Ui.GetScaledIcon(this, Resources.table, Resources.table32, dispose: false)); // ICON_VIEW imageList.Images.Add(Ui.GetScaledIcon(this, Resources.filter, Resources.filter32, dispose: false)); // ICON_LINKED_TABLE imageList.Images.Add(Ui.GetScaledIcon(this, Resources.link, Resources.link32, dispose: false)); // ICON_KEY imageList.Images.Add(Ui.GetScaledIcon(this, Resources.key, Resources.key32, dispose: false)); // ICON_COLUMN imageList.Images.Add(Ui.GetScaledIcon(this, Resources.bullet_white, Resources.bullet_white32, dispose: false)); _tree = new ExplorerTreeView { BorderStyle = BorderStyle.None, ContextMenuStrip = _contextMenuStrip, Dock = DockStyle.Fill, FullRowSelect = true, LabelEdit = true, ShowRootLines = true, }; _tree.ImageList = imageList; _tree.TreeViewNodeSorter = new ExplorerNodeComparer(); _tree.AfterLabelEdit += Tree_AfterLabelEdit; _tree.BeforeExpand += Tree_BeforeExpand; _tree.BeforeLabelEdit += Tree_BeforeLabelEdit; _tree.KeyDown += Tree_KeyDown; _tree.NodeMouseClick += Tree_NodeMouseClick; _tree.NodeMouseDoubleClick += Tree_NodeMouseDoubleClick; _tree.EnableDoubleBuffering(); _toolStripContainer.ContentPanel.Controls.Add(_tree); Ui ui = new(this, false); Padding buttonPadding = new(this.Scaled(2)); var newPageImage16 = Ui.SuperimposePlusSymbol(Resources.page); var newPageImage32 = Ui.SuperimposePlusSymbol(Resources.page32); ui.Init(_toolbarNewPageButton, newPageImage16, newPageImage32); var newScriptImage16 = Ui.SuperimposePlusSymbol(Resources.script); var newScriptImage32 = Ui.SuperimposePlusSymbol(Ui.ShiftImage(Resources.script32, 0, 1)); ui.Init(_toolbarNewScriptButton, newScriptImage16, newScriptImage32); _tree.GotFocus += (sender, e) => { _manager.CommitOpenEditors(); _manager.Rescan(notebookItemsOnly: true); }; }
public PageControl(string name, NotebookManager manager, IWin32Window mainForm) { ItemName = name; _manager = manager; _mainForm = mainForm; Controls.Add(_scrollPanel = new() { Dock = DockStyle.Fill, AutoScroll = true, }); _scrollPanel.Controls.Add(_flow = new() { AutoSize = true, AutoSizeMode = AutoSizeMode.GrowAndShrink, FlowDirection = FlowDirection.TopDown, WrapContents = false, Margin = Padding.Empty, }); Controls.Add(_toolStrip = new() { Dock = DockStyle.Top, }); _toolStrip.Items.Add(_executeAllButton = new ToolStripButton { Text = "Execute all" }); _executeAllButton.Click += ExecuteAllButton_Click; _toolStrip.Items.Add(_acceptAllButton = new ToolStripButton { Text = "Accept all", Enabled = false }); _acceptAllButton.Click += AcceptAllButton_Click; var separator = new ToolStripSeparator(); _toolStrip.Items.Add(separator); _toolStrip.Items.Add(_addTextButton = new ToolStripButton { Text = "Add text" }); _addTextButton.Click += AddTextButton_Click; _toolStrip.Items.Add(_addQueryButton = new ToolStripButton { Text = "Add query" }); _addQueryButton.Click += AddQueryButton_Click; _toolStrip.SetMenuAppearance(); DividerBlockControl divider = new(); divider.AddBlock += Divider_AddPart; InsertBlock(divider, 0); Ui ui = new(this, padded : false); ui.Init(_toolStrip); ui.Init(_executeAllButton, Resources.ControlPlayBlue, Resources.control_play_blue32); ui.Init(_acceptAllButton, Resources.accept_button, Resources.accept_button32); ui.Init(separator); var addTextIcon16 = Ui.SuperimposePlusSymbol(Resources.font); var addTextIcon32 = Ui.SuperimposePlusSymbol(Resources.font32); var addQueryIcon16 = Ui.SuperimposePlusSymbol(Resources.table); var addQueryIcon32 = Ui.SuperimposePlusSymbol(Resources.table32); ui.Init(_addTextButton, addTextIcon16, addTextIcon32); ui.Init(_addQueryButton, addQueryIcon16, addQueryIcon32); ui.Init(_scrollPanel); ui.Init(_flow); UserOptions.OnUpdateAndNow(this, () => { var opt = UserOptions.Instance; var colors = opt.GetColors(); BackColor = colors[UserOptionsColor.GRID_BACKGROUND]; }); UserOptions.OnUpdatePost(this, () => { OnSizeChanged(EventArgs.Empty); }); OnSizeChanged(EventArgs.Empty); LoadPage(); }