public void Rename(object sender, ExecutedRoutedEventArgs e) { var menuInfo = ValidateMenuInfo(sender); if (menuInfo == null) { return; } try { using (IRepository repository = Helpers.DataConnectionHelper.CreateRepository(menuInfo.DatabaseInfo)) { RenameDialog ro = new RenameDialog(menuInfo.Name); ro.ShowModal(); if (ro.DialogResult.HasValue && ro.DialogResult.Value == true && !string.IsNullOrWhiteSpace(ro.NewName) && !menuInfo.Name.Equals(ro.NewName)) { repository.RenameTable(menuInfo.Name, ro.NewName); if (ParentWindow != null && ParentWindow.Content != null) { ExplorerControl control = ParentWindow.Content as ExplorerControl; control.RefreshTables(menuInfo.DatabaseInfo); } Helpers.DataConnectionHelper.LogUsage("TableRename"); } } } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType, false); } }
public override void OnToolWindowCreated() { base.OnToolWindowCreated(); ExplorerControl.OnVsToolWindowCreated(this); // Advise IVsWindowFrameNotify so we know when we get hidden, etc. var frame = Frame as IVsWindowFrame2; if (frame != null) { _frameNotify = new VsWindowFrameNotifyHandler(frame); _frameNotify.Advise(); } // Hookup command handlers var commands = new List <IPackageCommandHandler> { //new CancelSearchToolWindowCommandHandler(this), // Add more here... }; var commandService = (IMenuCommandService)GetService(typeof(IMenuCommandService)); commands.ForEach(handler => commandService.AddCommand(handler.ToOleMenuCommand())); }
private void Button_Click(object sender, RoutedEventArgs e) { ExplorerControl.Show(); //XDocument doc = ManifestReader.GetAppManifest(); //var list = ManifestReader.GetRegisteredExtensions(); //Debug.WriteLine(doc.Root); }
private void DriveGroupBox_DoubleClick(object sender, EventArgs e) { if (ExplorerControl.TabPages[((GroupBox)sender).Name] != null) { ExplorerControl.SelectTab(((GroupBox)sender).Name); } else { ExplorerControl.TabPages.Add(((GroupBox)sender).Name, ((GroupBox)sender).Name); ExplorerControl.TabPages[((GroupBox)sender).Name].BackColor = Color.White; ExplorerControl.TabPages[((GroupBox)sender).Name].AutoScroll = true; foreach (var GetFile in new DirectoryInfo(((GroupBox)sender).Name).GetFiles()) { ExplorerControl.TabPages[((GroupBox)sender).Name].Controls.Add(CreateFolderGroupBox(GetFile.Name, GetFile.FullName)); } foreach (var GetDirectory in new DirectoryInfo(((GroupBox)sender).Name).GetDirectories()) { ExplorerControl.TabPages[((GroupBox)sender).Name].Controls.Add(CreateFolderGroupBox(GetDirectory.Name, GetDirectory.FullName)); } ExplorerControl.SelectTab(((GroupBox)sender).Name); } }
private void AddCeDatabase(DatabaseType dbType) { try { var dialog = new ConnectionDialog(); string path; if (TryGetInitialPath(package, out path)) { dialog.InitialPath = path; } dialog.DbType = dbType; dialog.ShowDdexInfo = package.VSSupportsSimpleDDEX4Provider() || package.VSSupportsSimpleDDEX35Provider(); dialog.CouldSupportPrivateProvider = (dbType == DatabaseType.SQLCE40 && (SqlCeToolboxPackage.VisualStudioVersion == new Version(12, 0) || SqlCeToolboxPackage.VisualStudioVersion == new Version(14, 0))) || (dbType == DatabaseType.SQLCE35 && package.VSSupportsEF6()); bool?result = dialog.ShowModal(); if (result.HasValue && result.Value == true) { if (!string.IsNullOrWhiteSpace(dialog.ConnectionString)) { Helpers.DataConnectionHelper.SaveDataConnection(dialog.ConnectionString, dbType, package); ExplorerControl control = _parentWindow.Content as ExplorerControl; control.BuildDatabaseTree(); Helpers.DataConnectionHelper.LogUsage("DatabasesAddCeDatabase"); } } } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, dbType); } }
public void AddSQLiteDatabase(object sender, ExecutedRoutedEventArgs e) { try { var dialog = new SQLiteConnectionDialog(); string path; if (TryGetInitialPath(package, out path)) { dialog.InitialPath = path; } bool?result = dialog.ShowModal(); if (result.HasValue && result.Value == true) { if (!string.IsNullOrWhiteSpace(dialog.ConnectionString)) { Helpers.DataConnectionHelper.SaveDataConnection(dialog.ConnectionString, DatabaseType.SQLite, package); ExplorerControl control = _parentWindow.Content as ExplorerControl; control.BuildDatabaseTree(); Helpers.DataConnectionHelper.LogUsage("DatabasesAddSQLiteDatabase"); } } } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, DatabaseType.SQLite); } }
public void DropSubscription(object sender, ExecutedRoutedEventArgs e) { if (EnvDteHelper.ShowMessageBox("Do you really want to remove replication metadata from the SQL Server Compact database?", Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.No) { return; } var menuItem = sender as MenuItem; if (menuItem == null) { return; } var menuInfo = menuItem.CommandParameter as MenuCommandParameters; if (menuInfo == null) { return; } try { SqlCeReplicationHelper.DropPublication(menuInfo.DatabaseInfo.ConnectionString, menuInfo.Name); if (_parentWindow != null && _parentWindow.Content != null) { ExplorerControl control = _parentWindow.Content as ExplorerControl; control.BuildDatabaseTree(); } Helpers.DataConnectionHelper.LogUsage("SubscriptionDrop"); } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType, false); } }
public void DropScope(object sender, ExecutedRoutedEventArgs e) { if (EnvDTEHelper.ShowMessageBox("Do you really want to deprovision this scope?", Microsoft.VisualStudio.Shell.Interop.OLEMSGBUTTON.OLEMSGBUTTON_YESNO, Microsoft.VisualStudio.Shell.Interop.OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_SECOND, Microsoft.VisualStudio.Shell.Interop.OLEMSGICON.OLEMSGICON_WARNING) == System.Windows.Forms.DialogResult.No) { return; } var menuItem = sender as MenuItem; if (menuItem == null) { return; } var menuInfo = menuItem.CommandParameter as MenuCommandParameters; if (menuInfo == null) { return; } try { SyncFxHelper.DeprovisionSqlCeScope(menuInfo.DatabaseInfo.ConnectionString, menuInfo.Name); EnvDTEHelper.ShowMessage("Scope deprovisioned"); if (_parentWindow != null && _parentWindow.Content != null) { ExplorerControl control = _parentWindow.Content as ExplorerControl; control.BuildDatabaseTree(); } Helpers.DataConnectionHelper.LogUsage("SyncScopeDrop"); } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, menuInfo.DatabaseInfo.DatabaseType); } }
public void AddCe35Database(object sender, ExecutedRoutedEventArgs e) { // http://www.mztools.com/articles/2007/MZ2007011.aspx if (!Helpers.DataConnectionHelper.DDEXProviderIsInstalled(new Guid(Resources.SqlCompact35Provider))) { EnvDTEHelper.ShowError("The version 3.5 Visual Studio DDEX provider is not installed, cannot add connection"); return; } try { var objIVsDataConnectionDialogFactory = package.GetServiceHelper(typeof(IVsDataConnectionDialogFactory)) as IVsDataConnectionDialogFactory; var objIVsDataConnectionDialog = objIVsDataConnectionDialogFactory.CreateConnectionDialog(); objIVsDataConnectionDialog.AddAllSources(); objIVsDataConnectionDialog.SelectedSource = new Guid("130BADA6-E128-423c-9D07-02E4734D45D4"); objIVsDataConnectionDialog.SelectedProvider = new Guid(Resources.SqlCompact35Provider); if (objIVsDataConnectionDialog.ShowDialog() && objIVsDataConnectionDialog.SelectedProvider == new Guid(Resources.SqlCompact35Provider)) { Helpers.DataConnectionHelper.SaveDataConnection(package, objIVsDataConnectionDialog.EncryptedConnectionString, objIVsDataConnectionDialog.DisplayConnectionString, DatabaseType.SQLCE35, new Guid(Resources.SqlCompact35Provider)); ExplorerControl control = _parentWindow.Content as ExplorerControl; control.BuildDatabaseTree(); Helpers.DataConnectionHelper.LogUsage("DatabasesAddCe35Database"); } objIVsDataConnectionDialog.Dispose(); } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, DatabaseType.SQLCE35); } }
public static void Register(ExplorerControl explorerControl) { var id = Interlocked.Increment(ref _explorerCounter); explorerControl.ExplorerId = id; _explorers.TryAdd(id, explorerControl); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (!_loaded) { DataConnectionHelper.Monitor = EQATEC.Analytics.Monitor.AnalyticsMonitorFactory.CreateMonitor("C244D8923C7C4235A1A24AB1127BD521"); DataConnectionHelper.Monitor.Start(); ExtractDll("QuickGraph.dll"); ExtractDll("QuickGraph.Data.dll"); if (DataConnectionHelper.Argument != null) { string filePath = DataConnectionHelper.Argument.ToLowerInvariant(); if (System.IO.File.Exists(filePath)) { var connStr = string.Format("Data Source={0};Max Database Size=4091", filePath); var databaseList = DataConnectionHelper.GetDataConnections(); var item = databaseList.Where(d => d.Value.StartsWith(connStr)).FirstOrDefault(); if (item.Value == null) { try { TrySave(connStr); } catch (Exception ex) { string error = DataConnectionHelper.ShowErrors(ex); if (error.Contains("Minor Err.: 25028")) { PasswordDialog pwd = new PasswordDialog(); pwd.ShowDialog(); if (pwd.DialogResult.HasValue && pwd.DialogResult.Value == true && !string.IsNullOrWhiteSpace(pwd.Password)) { connStr = connStr + ";Password="******"SQL Server Compact Toolbox for runtime " + RepoHelper.apiVer; _explorerControl = new ExplorerControl(fabTab); MainGrid.Children.Add(_explorerControl); } _loaded = true; }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (!_loaded) { Telemetry.Initialize(Assembly.GetExecutingAssembly().GetName().Version.ToString(), "d4881a82-2247-42c9-9272-f7bc8aa29315"); ExtractDll("QuickGraph.dll"); ExtractDll("QuickGraph.Data.dll"); if (DataConnectionHelper.Argument != null) { string filePath = DataConnectionHelper.Argument.ToLowerInvariant(); if (System.IO.File.Exists(filePath)) { var connStr = string.Format("Data Source={0};Max Database Size=4091", filePath); var databaseList = DataConnectionHelper.GetDataConnections(); var item = databaseList.Where(d => d.Value.StartsWith(connStr)).FirstOrDefault(); if (item.Value == null) { try { TrySave(connStr); } catch (Exception ex) { string error = DataConnectionHelper.ShowErrors(ex); if (error.Contains("Minor Err.: 25028")) { PasswordDialog pwd = new PasswordDialog(); pwd.ShowDialog(); if (pwd.DialogResult.HasValue && pwd.DialogResult.Value == true && !string.IsNullOrWhiteSpace(pwd.Password)) { connStr = connStr + ";Password="******"SQL Server Compact Toolbox for runtime " + RepoHelper.apiVer; _explorerControl = new ExplorerControl(fabTab); MainGrid.Children.Add(_explorerControl); } _loaded = true; }
public IndexContextMenu(MenuCommandParameters menuCommandParameters, ExplorerControl parent) { var tcmd = new IndexMenuCommandsHandler(parent); CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters); CreateScriptAsDropMenuItem(tcmd, menuCommandParameters); Items.Add(new Separator()); CreateScriptAsStatisticsMenuItem(tcmd, menuCommandParameters); }
public ColumnContextMenu(MenuCommandParameters menuCommandParameters, ExplorerControl parent) { var tcmd = new ColumnMenuCommandsHandler(parent); CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters); CreateScriptAsDropMenuItem(tcmd, menuCommandParameters); CreateScriptAsAlterMenuItem(tcmd, menuCommandParameters); Items.Add(new Separator()); CreateDescriptionMenuItem(tcmd, menuCommandParameters); }
public override void OnToolWindowCreated() { base.OnToolWindowCreated(); ExplorerControl.OnVsToolWindowCreated(this); _txtMgr = (IVsTextManager)GetService(typeof(SVsTextManager)); _componentModel = (IComponentModel)GetService(typeof(SComponentModel)); _editorAdaptersFactoryService = (IVsEditorAdaptersFactoryService)_componentModel.GetService <IVsEditorAdaptersFactoryService>(); //_editorPrimitivesFactoryService = (IEditorPrimitivesFactoryService)_componentModel.GetService<IEditorPrimitivesFactoryService>(); EnvDTE.DTE dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); EnvDTE80.Events2 events = (EnvDTE80.Events2)dte.Events; this.WindowEvents = (EnvDTE.WindowEvents)events.get_WindowEvents(null); this.WindowEvents.WindowActivated += (Window GotFocus, Window LostFocus) => { if (GotFocus.ObjectKind.ToString().ToLower().Equals("{" + GuidList.GuidCodeSearchToolWindowString + "}")) { var word = GetSelectedOrWord(); if (word.Equals("")) { return; } ExplorerControl.SearchCodeCombo.Text = GetSelectedOrWord(); //ExplorerControl.SearchCodeCombo.Focus(); } }; // Advise IVsWindowFrameNotify so we know when we get hidden, etc. var frame = Frame as IVsWindowFrame2; if (frame != null) { _frameNotify = new VsWindowFrameNotifyHandler(frame); _frameNotify.Advise(); //_frameNotify.OnShowCallBack = () => { // ExplorerControl.SearchCodeCombo.Focus(); // var vsp = Package as VsPackage; // var ts = vsp.DTE.ActiveDocument.Selection as TextSelection; // //if (ts != null) // // ExplorerControl.SearchCodeCombo.Text = ts.Text; //}; } // Hookup command handlers var commands = new List <IPackageCommandHandler> { new PreviousLocationCommandHandler(this), new NextLocationCommandHandler(this), new CancelSearchCommandHandler(this), //new CancelSearchToolWindowCommandHandler(this), // Add more here... }; var commandService = (IMenuCommandService)GetService(typeof(IMenuCommandService)); commands.ForEach(handler => commandService.AddCommand(handler.ToOleMenuCommand())); }
private void CreateFolderMenuStripItem_Click(object sender, EventArgs e) { DirectoryInfo GetInfo = new DirectoryInfo(((ToolStripMenuItem)sender).Name); if (((ToolStripMenuItem)sender).Text == "Открыть") { if ((GetInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory) { try { ExplorerControl.TabPages.Add(((ToolStripMenuItem)sender).Name, ((ToolStripMenuItem)sender).Name); ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name].BackColor = Color.White; ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name].AutoScroll = true; foreach (var GetFile in GetInfo.GetFiles()) { ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name].Controls.Add(CreateFolderGroupBox(GetFile.Name, GetFile.FullName)); } foreach (var GetDirectory in GetInfo.GetDirectories()) { ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name].Controls.Add(CreateFolderGroupBox(GetDirectory.Name, GetDirectory.FullName)); } ExplorerControl.SelectTab(((ToolStripMenuItem)sender).Name); } catch (Exception EX) { MessageBox.Show(EX.Message, "UIExplorer", MessageBoxButtons.OK, MessageBoxIcon.Error); ExplorerControl.TabPages.Remove(ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name]); } } else { Process.Start(((ToolStripMenuItem)sender).Name); } } else { if ((GetInfo.Attributes & FileAttributes.Directory) != FileAttributes.Directory) { ExplorerControl.TabPages.Add(((ToolStripMenuItem)sender).Name, ((ToolStripMenuItem)sender).Name); ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name].BackColor = Color.White; ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name].AutoScroll = true; ExplorerControl.TabPages[((ToolStripMenuItem)sender).Name].Controls.Add(CreateTextBox(((ToolStripMenuItem)sender).Name)); ExplorerControl.SelectTab(((ToolStripMenuItem)sender).Name); } } }
public void FixConnections(object sender, ExecutedRoutedEventArgs e) { try { new DataConnectionHelper().ValidateConnections(package); ExplorerControl control = _parentWindow.Content as ExplorerControl; control.BuildDatabaseTree(); Helpers.DataConnectionHelper.LogUsage("DatabasesFixConnections"); } catch (Exception ex) { Helpers.DataConnectionHelper.SendError(ex, DatabaseType.SQLServer, false); } }
public void AddTab(StorageFolder storageFolder) { var explorer = new ExplorerControl(); explorer.ExplorerTag = ExplorerTabTag + Items.Count; explorer.ExplorerManagerControl = ExplorerManager; explorer.RootFolder = storageFolder; var pvItem = ConfigurePivotItem(explorer); Items.Add(pvItem); ExplorerTabs.SelectedIndex = Items.Count - 1; ForceFocusSelectedExplorer(); }
// Data private async Task SendData() { transferStopwatch = new Stopwatch(); transferStopwatch.Start(); int totalItemCount = 0; await Task.Run(() => { // Send files info byte[] infoBuffer = new byte[13]; infoBuffer[0] = (byte)TTInstruction.Transfer_TransferInfo; totalItemCount = items.Count(); foreach (var item in items) { totalItemCount += item.GetTotalChildCount(); } byte[] countBytes = BitConverter.GetBytes(totalItemCount); Array.Copy(countBytes, 0, infoBuffer, 1, 4); long totalSize = 0; foreach (var item in items) { totalSize += item.GetTotalSize(); } byte[] sizeBytes = BitConverter.GetBytes(totalSize); Array.Copy(sizeBytes, 0, infoBuffer, 1 + 4, 8); TrySend(infoBuffer, true); // Send data bytesSent = 0; totalBytes = totalSize; foreach (var item in items) { if (item.IsFolder) { SendFolder(item, ""); } else { SendFile(item, ""); } } }); transferStopwatch.Stop(); OnRecordableEvent($"Sucessfully sent {totalItemCount} item/s ({ExplorerControl.FormatFileSize(bytesSent)}) in {TTNet.FormatTimeSpan(transferStopwatch.Elapsed)} at average { ExplorerControl.FormatFileSize(totalBytes * 1000 / transferStopwatch.ElapsedMilliseconds)}/s.", Console.ConsoleMessageType.Common); }
public TableContextMenu(MenuCommandParameters menuCommandParameters, ExplorerControl parent) { var tcmd = new TableMenuCommandsHandler(parent); CreateEditDataMenuItem(tcmd, menuCommandParameters); CreateViewReportMenuItem(tcmd, menuCommandParameters); Items.Add(new Separator()); CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters); CreateScriptAsDropMenuItem(tcmd, menuCommandParameters); CreateScriptAsDropAndCreateMenuItem(tcmd, menuCommandParameters); Items.Add(new Separator()); CreateScriptAsSelectMenuItem(tcmd, menuCommandParameters); CreateScriptAsInsertMenuItem(tcmd, menuCommandParameters); CreateScriptAsUpdateMenuItem(tcmd, menuCommandParameters); CreateScriptAsDeleteMenuItem(tcmd, menuCommandParameters); CreateScriptAsDataMenuItem(tcmd, menuCommandParameters); Items.Add(new Separator()); ImportDataMenuItem(tcmd, menuCommandParameters); Items.Add(new Separator()); DescriptionMenuItem(tcmd, menuCommandParameters); Items.Add(new Separator()); RenameMenuItem(tcmd, menuCommandParameters); }
private PivotItem ConfigurePivotItem(ExplorerControl explorer) { var pvItem = new PivotItem() { Content = explorer }; var pvHeader = new ExplorerTabHeader { AllowDrop = true }; pvHeader.Drop += PivotHeaderItem_OnDrop; pvHeader.DragOver += PivotHeaderItem_OnDragOver; pvItem.Header = pvHeader; pvHeader.SetBinding(ExplorerTabHeader.LabelTextProperty, new Binding() { Path = new PropertyPath("CurrentFolder.DisplayName"), Source = explorer, Mode = BindingMode.OneWay }); return(pvItem); }
public DatabasesContextMenu(DatabasesMenuCommandParameters databaseMenuCommandParameters, ExplorerControl parent) { var dcmd = new DatabaseMenuCommandsHandler(parent); var toolTip1 = new ToolTip(); bool runtimeIsInstalled = DataConnectionHelper.IsRuntimeInstalled(); if (runtimeIsInstalled) { toolTip1.Content = string.Format("Install SQL Server Compact {0} desktop runtime to enable this feature", RepoHelper.apiVer); } else { toolTip1.Content = string.Format("Add SQL Server Compact {0} Connection", RepoHelper.apiVer); } var addCeDatabaseCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.AddCeDatabase); var addCeDatabaseMenuItem = new MenuItem { Header = string.Format("Add SQL Server Compact {0} Connection...", RepoHelper.apiVer), Icon = ImageHelper.GetImageFromResource("../resources/AddTableHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, ToolTip = toolTip1, CommandParameter = databaseMenuCommandParameters, }; addCeDatabaseMenuItem.CommandBindings.Add(addCeDatabaseCommandBinding); addCeDatabaseMenuItem.IsEnabled = runtimeIsInstalled; Items.Add(addCeDatabaseMenuItem); Items.Add(new Separator()); var scriptGraphCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.GenerateServerDgmlFiles); var toolTip = new ToolTip(); toolTip.Content = "Generate a SQL Server Compact compatible database script from SQL Server 2005/2008"; var scriptDatabaseGraphMenuItem = new MenuItem { Header = "Create SQL Server Database Graph (DGML)...", Icon = ImageHelper.GetImageFromResource("../resources/RelationshipsHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, }; scriptDatabaseGraphMenuItem.CommandBindings.Add(scriptGraphCommandBinding); Items.Add(scriptDatabaseGraphMenuItem); Items.Add(new Separator()); var scriptDatabaseCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.ScriptServerDatabase); var scriptDatabaseSchemaMenuItem = new MenuItem { Header = "Script SQL Server Database Schema...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), ToolTip = toolTip, Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.Schema }; scriptDatabaseSchemaMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); Items.Add(scriptDatabaseSchemaMenuItem); var scriptDatabaseDataMenuItem = new MenuItem { Header = "Script SQL Server Database Data...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), ToolTip = toolTip, Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.DataOnly }; scriptDatabaseDataMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); Items.Add(scriptDatabaseDataMenuItem); var scriptDatabaseSchemaDataMenuItem = new MenuItem { Header = "Script SQL Server Database Schema and Data...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), ToolTip = toolTip, Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.SchemaData }; scriptDatabaseSchemaDataMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); Items.Add(scriptDatabaseSchemaDataMenuItem); var scriptDatabaseSchemaDataBLOBMenuItem = new MenuItem { Header = "Script SQL Server Database Schema and Data with BLOBs...", ToolTip = toolTip, Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.SchemaDataBlobs }; scriptDatabaseSchemaDataBLOBMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); Items.Add(scriptDatabaseSchemaDataBLOBMenuItem); Items.Add(new Separator()); var exportServerCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.ExportServerDatabaseTo40); var exportServerMenuItem = new MenuItem { Header = string.Format("Export SQL Server to SQL Server Compact {0} ...", RepoHelper.apiVer), Icon = ImageHelper.GetImageFromResource("../resources/data_out_small.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters }; exportServerMenuItem.CommandBindings.Add(exportServerCommandBinding); exportServerMenuItem.IsEnabled = runtimeIsInstalled; Items.Add(exportServerMenuItem); Items.Add(new Separator()); var detectDatabaseCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.CheckCeVersion); var versionDetectMenuItem = new MenuItem { Header = "Detect SQL Server Compact file version...", Icon = ImageHelper.GetImageFromResource("../resources/ZoomHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, }; versionDetectMenuItem.CommandBindings.Add(detectDatabaseCommandBinding); Items.Add(versionDetectMenuItem); //if (RepoHelper.apiVer == "4.0" && 1 == 0) //{ // Items.Add(new Separator()); // var installDDEX4CommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, // dcmd.InstallDDEX4); // var installDDEX4MenuItem = new MenuItem // { // Header = "Enable VS Express 2013 to use SQL Server Compact 4.0 with Entity Framework 6", // Icon = ImageHelper.GetImageFromResource("../resources/RelationshipsHS.png"), // Command = DatabaseMenuCommands.DatabaseCommand, // CommandParameter = databaseMenuCommandParameters, // }; // installDDEX4MenuItem.CommandBindings.Add(installDDEX4CommandBinding); // Items.Add(installDDEX4MenuItem); //} }
public static void Unregister(ExplorerControl explorerControl) { var id = explorerControl.ExplorerId; _explorers.TryRemove(id, out ExplorerControl outValue); }
public DatabaseMenuCommandsHandler(ExplorerControl parent) { _parentWindow = parent; }
public DatabaseContextMenu(DatabaseMenuCommandParameters databaseMenuCommandParameters, ExplorerControl parent) { var dcmd = new DatabaseMenuCommandsHandler(parent); var showSqlEditorCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.SpawnSqlEditorWindow); var showSqlEditorMenuItem = new MenuItem { Header = "Open SQL Editor", Icon = ImageHelper.GetImageFromResource("../resources/sqlEditor.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters }; showSqlEditorMenuItem.CommandBindings.Add(showSqlEditorCommandBinding); Items.Add(showSqlEditorMenuItem); var createTableCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.BuildTable); var createTableMenuItem = new MenuItem { Header = "Build Table (alpha)...", Icon = ImageHelper.GetImageFromResource("../resources/sqlEditor.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters }; createTableMenuItem.CommandBindings.Add(createTableCommandBinding); Items.Add(createTableMenuItem); Items.Add(new Separator()); var scriptMenuItem = new MenuItem { Header = "Script", Icon = ImageHelper.GetImageFromResource("../resources/database.png") }; var scriptDatabaseCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.ScriptDatabase); var scriptDatabaseSchemaMenuItem = new MenuItem { Header = "Script Database Schema...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.Schema }; scriptDatabaseSchemaMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); scriptMenuItem.Items.Add(scriptDatabaseSchemaMenuItem); var scriptDatabaseSchemaDataMenuItem = new MenuItem { Header = "Script Database Schema and Data...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.SchemaData }; scriptDatabaseSchemaDataMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); scriptMenuItem.Items.Add(scriptDatabaseSchemaDataMenuItem); var scriptAzureSchemaDataMenuItem = new MenuItem { Header = "Script Database Schema and Data for SQL Azure...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.SchemaDataAzure }; scriptAzureSchemaDataMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); scriptMenuItem.Items.Add(scriptAzureSchemaDataMenuItem); var scriptSqliteSchemaDataMenuItem = new MenuItem { Header = "Script Database Schema and Data for SQLite (beta)...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.SchemaDataSQLite }; scriptSqliteSchemaDataMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); scriptMenuItem.Items.Add(scriptSqliteSchemaDataMenuItem); var scriptDatabaseSchemaDataBLOBMenuItem = new MenuItem { Header = "Script Database Schema and Data with BLOBs...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.SchemaDataBlobs }; scriptDatabaseSchemaDataBLOBMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); scriptMenuItem.Items.Add(scriptDatabaseSchemaDataBLOBMenuItem); var scriptDatabaseDataMenuItem = new MenuItem { Header = "Script Database Data...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.DataOnly }; scriptDatabaseDataMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); scriptMenuItem.Items.Add(scriptDatabaseDataMenuItem); var scriptDatabaseDataForServerMenuItem = new MenuItem { Header = "Script Database Data for SQL Server...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = SqlCeScripting.Scope.DataOnlyForSqlServer }; scriptDatabaseDataForServerMenuItem.CommandBindings.Add(scriptDatabaseCommandBinding); scriptMenuItem.Items.Add(scriptDatabaseDataForServerMenuItem); Items.Add(scriptMenuItem); Items.Add(new Separator()); var scriptDiffCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.GenerateDiffScript); var scriptDatabaseDiffMenuItem = new MenuItem { Header = "Script Database Diff...", Icon = ImageHelper.GetImageFromResource("../resources/database.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, }; scriptDatabaseDiffMenuItem.CommandBindings.Add(scriptDiffCommandBinding); scriptDatabaseDiffMenuItem.ToolTip = "Script all tables, columns and constraints in this database\r\nthat are missing/different in the target database."; Items.Add(scriptDatabaseDiffMenuItem); Items.Add(new Separator()); var scriptGraphCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.GenerateCeDgmlFiles); var scriptDatabaseGraphMenuItem = new MenuItem { Header = "Create Database Graph (DGML)...", Icon = ImageHelper.GetImageFromResource("../resources/RelationshipsHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, }; scriptDatabaseGraphMenuItem.CommandBindings.Add(scriptGraphCommandBinding); Items.Add(scriptDatabaseGraphMenuItem); // Documentation menu item var docDbCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.GenerateDocFiles); var docDatabaseMenuItem = new MenuItem { Header = "Create Database Documentation...", Icon = ImageHelper.GetImageFromResource("../resources/RelationshipsHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, }; docDatabaseMenuItem.CommandBindings.Add(docDbCommandBinding); Items.Add(docDatabaseMenuItem); Items.Add(new Separator()); var scriptDCCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.GenerateDataContext); // Desktop Data Context var scriptDCMenuItem = new MenuItem { Header = "Create LINQ to SQL DataContext class...", Icon = ImageHelper.GetImageFromResource("../resources/RelationshipsHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = true }; scriptDCMenuItem.CommandBindings.Add(scriptDCCommandBinding); Items.Add(scriptDCMenuItem); //Windows Phone Data Context var scriptWPDCMenuItem = new MenuItem { Header = "Create Windows Phone DataContext class...", Icon = ImageHelper.GetImageFromResource("../resources/Phone.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, Tag = false }; scriptWPDCMenuItem.CommandBindings.Add(scriptDCCommandBinding); #if V35 scriptWPDCMenuItem.IsEnabled = true; #else scriptWPDCMenuItem.IsEnabled = false; #endif Items.Add(scriptWPDCMenuItem); Items.Add(new Separator()); var maintenanceMenuItem = new MenuItem { Header = "Maintenance", Icon = ImageHelper.GetImageFromResource("../resources/SplitSubdocumentHS.png"), }; var shrinkCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.ShrinkDatabase); var shrinkMenuItem = new MenuItem { Header = "Shrink", Icon = ImageHelper.GetImageFromResource("../resources/SplitSubdocumentHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, ToolTip = "Shrink database by deleting free pages" }; shrinkMenuItem.CommandBindings.Add(shrinkCommandBinding); maintenanceMenuItem.Items.Add(shrinkMenuItem); var compactCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.CompactDatabase); var compactMenuItem = new MenuItem { Header = "Compact", Icon = ImageHelper.GetImageFromResource("../resources/SplitSubdocumentHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, ToolTip = "Perform full database compaction" }; compactMenuItem.CommandBindings.Add(compactCommandBinding); maintenanceMenuItem.Items.Add(compactMenuItem); var verifyCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.VerifyDatabase); var verifyMenuItem = new MenuItem { Header = "Verify", Icon = ImageHelper.GetImageFromResource("../resources/SplitSubdocumentHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, ToolTip = "Verify the integrity of the database (enhanced)" }; verifyMenuItem.CommandBindings.Add(verifyCommandBinding); maintenanceMenuItem.Items.Add(verifyMenuItem); var repairDeleteCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.RepairDatabaseDeleteCorruptedRows); var repairDeleteMenuItem = new MenuItem { Header = "Repair (delete corrupted rows)", Icon = ImageHelper.GetImageFromResource("../resources/SplitSubdocumentHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, ToolTip = "Repairs a corrupted database" }; repairDeleteMenuItem.CommandBindings.Add(repairDeleteCommandBinding); maintenanceMenuItem.Items.Add(repairDeleteMenuItem); var repairRecoverAllCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.RepairDatabaseRecoverAllOrFail); var repairRecoverAllMenuItem = new MenuItem { Header = "Repair (recover all or fail)", Icon = ImageHelper.GetImageFromResource("../resources/SplitSubdocumentHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, ToolTip = "Repairs a corrupted database" }; repairRecoverAllMenuItem.CommandBindings.Add(repairRecoverAllCommandBinding); maintenanceMenuItem.Items.Add(repairRecoverAllMenuItem); var repairRecoverPossibleCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.RepairDatabaseRecoverAllPossibleRows); var repairRecoverPossibleMenuItem = new MenuItem { Header = "Repair (recover all possible)", Icon = ImageHelper.GetImageFromResource("../resources/SplitSubdocumentHS.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters, ToolTip = "Repairs a corrupted database" }; repairRecoverPossibleMenuItem.CommandBindings.Add(repairRecoverPossibleCommandBinding); maintenanceMenuItem.Items.Add(repairRecoverPossibleMenuItem); Items.Add(maintenanceMenuItem); Items.Add(new Separator()); var addDescriptionCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.AddDescription); var addDescriptionMenuItem = new MenuItem { Header = "Edit description", Icon = ImageHelper.GetImageFromResource("../resources/propes.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters }; addDescriptionMenuItem.CommandBindings.Add(addDescriptionCommandBinding); Items.Add(addDescriptionMenuItem); Items.Add(new Separator()); var removeCeConnectionCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand, dcmd.RemoveCeDatabase); var removeCeConnectionMenuItem = new MenuItem { Header = "Remove Connection", Icon = ImageHelper.GetImageFromResource("../resources/delete.png"), Command = DatabaseMenuCommands.DatabaseCommand, CommandParameter = databaseMenuCommandParameters }; removeCeConnectionMenuItem.CommandBindings.Add(removeCeConnectionCommandBinding); Items.Add(removeCeConnectionMenuItem); }
public ColumnMenuCommandsHandler(ExplorerControl parent) { _parentWindow = parent; _handler = new BaseCommandHandler(parent); }
public BaseCommandHandler(ExplorerControl parent) { _parent = parent; }
public SubscriptionsContextMenu(MenuCommandParameters subsMenuCommandParameters, ExplorerControl parent) { var dcmd = new SubscriptionsMenuCommandsHandler(parent); if (subsMenuCommandParameters.MenuItemType == MenuCommandParameters.MenuType.Manage) { var newSubsCommandBinding = new CommandBinding(SubscriptionsMenuCommands.SubscriptionCommand, dcmd.NewSubscription); var newSubsMenuItem = new MenuItem { Header = "Manage Subscription...", Icon = ImageHelper.GetImageFromResource("../resources/subs.png"), Command = SubscriptionsMenuCommands.SubscriptionCommand, CommandParameter = subsMenuCommandParameters, }; newSubsMenuItem.CommandBindings.Add(newSubsCommandBinding); Items.Add(newSubsMenuItem); var dropSubsCommandBinding = new CommandBinding(SubscriptionsMenuCommands.SubscriptionCommand, dcmd.DropSubscription); var dropSubsMenuItem = new MenuItem { Header = "Drop Subscription...", Icon = ImageHelper.GetImageFromResource("../resources/subs.png"), Command = SubscriptionsMenuCommands.SubscriptionCommand, CommandParameter = subsMenuCommandParameters, }; dropSubsMenuItem.CommandBindings.Add(dropSubsCommandBinding); Items.Add(dropSubsMenuItem); } else { var newSubsCommandBinding = new CommandBinding(SubscriptionsMenuCommands.SubscriptionCommand, dcmd.NewSubscription); var newSubsMenuItem = new MenuItem { Header = "New Subscription...", Icon = ImageHelper.GetImageFromResource("../resources/subs.png"), Command = SubscriptionsMenuCommands.SubscriptionCommand, CommandParameter = subsMenuCommandParameters, }; newSubsMenuItem.CommandBindings.Add(newSubsCommandBinding); Items.Add(newSubsMenuItem); } }
public IndexMenuCommandsHandler(ExplorerControl parent) { _parentWindow = parent; }
public SubscriptionsMenuCommandsHandler(ExplorerControl parent) { _parent = parent; }