private static void AssociateTorrents(string installationPath) { var path = Path.Combine(installationPath, "Patchy.exe"); var startup = string.Format("\"{0}\" \"%1\"", path); using (var torrent = Registry.ClassesRoot.CreateSubKey(".torrent")) { torrent.SetValue(null, "Patchy.exe"); torrent.SetValue("Content Type", "application/x-bittorrent"); } using (var patchy = Registry.ClassesRoot.CreateSubKey("Patchy.exe")) { patchy.SetValue(null, "BitTorrent File"); patchy.SetValue("DefaultIcon", path + ",0"); using (var shell = patchy.CreateSubKey("shell")) using (var open = shell.CreateSubKey("open")) using (var command = open.CreateSubKey("command")) command.SetValue(null, startup); } ShellNotification.NotifyOfChange(); }
public MessageHandlerBoxResult Show(string messageXml) { this.Owner = Application.Current.MainWindow; yesButton.Visibility = Visibility.Collapsed; noButton.Visibility = Visibility.Collapsed; okButton.Visibility = Visibility.Collapsed; cancelButton.Visibility = Visibility.Collapsed; // Parse the messages ParseMessageXML(messageXml); // Check what severe states we have if (messageList.Where(i => i.Type == MessageHandlerItemType.Error).Count() > 0) { // Got errors // Set visibility on buttons okButton.Visibility = Visibility.Visible; okButton.IsCancel = true; okButton.IsDefault = true; messageTextBlock.Visibility = Visibility.Collapsed; // Check if also have warnings if (messageList.Where(i => i.Type == MessageHandlerItemType.Warning).Count() > 0) { this.Title = StringResources.MessageHandlerBox_ErrorWarning_Headline; captionLabel.Text = StringResources.MessageHandlerBox_ErrorWarning_Headline; } else { this.Title = StringResources.MessageHandlerBox_Error_Headline; captionLabel.Text = StringResources.MessageHandlerBox_Error_Headline; } } else if (messageList.Where(i => i.Type == MessageHandlerItemType.Warning).Count() > 0) { // Got warnings // Set visibility on buttons yesButton.Visibility = Visibility.Visible; yesButton.IsDefault = true; noButton.Visibility = Visibility.Visible; noButton.IsCancel = true; this.Title = StringResources.MessageHandlerBox_Warning_Headline; captionLabel.Text = StringResources.MessageHandlerBox_Warning_Headline; messageTextBlock.Text = StringResources.MessageHandlerBox_Warning_Question; } else { // Got information, show as notification foreach (MessageHandlerDataItem item in messageList) { ShellNotification notification = new ShellNotification(item.Text, null); ShellInteractionService.ShowNotification(notification); } WorkItem.SmartParts.Remove(this); return(MessageHandlerBoxResult.Ok); } // Set the items source for the listbox so it gets populated. this.messageListBox.ItemsSource = messageList; // Show dialog base.ShowDialog(); // Remove from smart parts. Added from where it's called! WorkItem.SmartParts.Remove(this); ShellInteractionService.ShowProgress(); return(result); }
public void ShowNotification(ShellNotification notification) { _shellView.ShowNotification(_module.Title, notification); }
public static void NotifyShellOfChange() { ShellNotification.NotifyOfChange(); }