private void btnUnInstallStlServer_Click(object sender, EventArgs e) { string stlViewerThumbnail = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Marlin3DprinterToolStlThumbnail.dll"); bool osIs32Bit = chkBx32BitOS.Checked; SharpShellServerManagerClass.Unregister(stlViewerThumbnail, osIs32Bit); UpdateServerStatus(); }
private void btnResetAndCleanExistingThumbnails_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show( @"Be sure that all important work is SAVED!" + Environment.NewLine + Environment.NewLine + @"This is a more BRUTAL method of reseting the File Explorer Thumbnails" , @"Forced Delete of Thumbnail cache", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); if (result == DialogResult.Cancel) { return; } SharpShellServerManagerClass.ResetAndCleanExistingThumbnails(); MessageBox.Show(@"Forced Delete of Thumbnail Cache and Restart of Explorer is DONE!", @"Restart of Explorer", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnRestartWindowsFileExplorer_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show( @"Be sure that all important work is SAVED!" + Environment.NewLine + Environment.NewLine + @"Explorer will be forced to restart" , @"Restarting Explorer", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); if (result == DialogResult.Cancel) { return; } SharpShellServerManagerClass.RestartExplorer(); MessageBox.Show(@"Restart of Explorer DONE!", @"Restart of Explorer", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void UpdateServerStatus() { string stlViewerThumbnail = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Marlin3DprinterToolStlThumbnail.dll"); //TODO: SharpShellServerManagerClass.Serverentries IEnumerable <ServerEntry> serverEntries = SharpShellServerManagerClass.UpdateServerStatus(stlViewerThumbnail); if (serverEntries != null) { foreach (ServerEntry serverEntry in serverEntries) { SharpShellServerManagerClass.ServerInfo serverinfo = SharpShellServerManagerClass.GetServerinfo(serverEntry); textBoxServerName.Text = serverinfo.ServerName; textBoxServerType.Text = serverinfo.ServerType; textBoxServerCLSID.Text = serverinfo.ClassId; textBoxServerSecurity.Text = serverinfo.SecurityStatus; textBoxAssemblyPath.Text = serverinfo.ServerPath; if (serverinfo.IsInvalid) { // Clear other data for invalid servers. textBoxAssociations.Text = string.Empty; ledServer32.Color = Color.Gray; ledServer64.Color = Color.Gray; ledRegister32.Color = Color.Gray; ledRegister64.Color = Color.Gray; } else { textBoxAssociations.Text = serverinfo.Association; // By default, our installation info is going all led gray. ledServer32.Color = Color.Gray; ledServer64.Color = Color.Gray; ledRegister32.Color = Color.Gray; ledRegister64.Color = Color.Gray; // Do we have 32 bit registration info? if (serverinfo.Info32 != null) { // Do we have a codebase? if (!string.IsNullOrEmpty(serverinfo.Info32.CodeBase)) { //textBox32BitServer.Text = info32.CodeBase; ledServer32.Color = Color.Chartreuse; } else if (!string.IsNullOrEmpty(serverinfo.Info32.Assembly)) { //textBox32BitServer.Text = info32.Assembly + " (GAC)"; ledServer32.Color = Color.Chartreuse; } // Set the registration info. if (serverinfo.Info32.IsApproved) { //textBox32BitServerRegistration.Text = "Registered"; ledRegister32.Color = Color.Chartreuse; } } // Do we have 64 bit registration info? if (serverinfo.Info64 != null) { // Do we have a codebase? if (!string.IsNullOrEmpty(serverinfo.Info64.CodeBase)) { //textBox64BitServer.Text = info64.CodeBase; ledServer64.Color = Color.Chartreuse; } else if (!string.IsNullOrEmpty(serverinfo.Info64.Assembly)) { //textBox64BitServer.Text = info64.Assembly + " (GAC)"; ledServer64.Color = Color.Chartreuse; } // Set the registration info. if (serverinfo.Info64.IsApproved) { //textBox64BitServerRegistration.Text = "Registered"; ledRegister64.Color = Color.Chartreuse; } } } } } }