protected override void WndProc(ref Message m) { // if (m.Msg == Windows7Taskbar.TaskbarButtonCreatedMessage) { _jumpListManager = new JumpListManager(APP_ID); _jumpListManager.UserRemovedItems += delegate { }; _jumpListManager.AddUserTask(new ShellLink { Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Windows NT\Accessories\wordpad.exe"), Title = "Launch Wordpad" }); _jumpListManager.AddCustomDestination(new ShellItem { Path = "C:\\Document1.rtf", Category = "Interesting" }); _jumpListManager.Refresh(); } base.WndProc(ref m); }
protected override void WndProc(ref Message m) { if (m.Msg == Windows7Taskbar.TaskbarButtonCreatedMessage) { _jumpListManager = new JumpListManager(APP_ID); _jumpListManager.UserRemovedItems += delegate { }; _jumpListManager.AddUserTask(new ShellLink { Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Windows NT\Accessories\wordpad.exe"), Title = "Launch Wordpad" }); _jumpListManager.AddCustomDestination(new ShellItem { Path = @"D:\Users\Sasha\Documents\Courses\Windows 7\Code\SampleDocument.rtf", Category = "Interesting" }); _jumpListManager.Refresh(); } if (_clipToggled) { SetClip(); } if (_customWindowManager != null) { _customWindowManager.DispatchMessage(ref m); _customWindowManager.InvalidatePreviews(); } base.WndProc(ref m); }
private void MainForm_Shown(object sender, EventArgs e) { JumpListManager.AddCategorySelfLink("Commands", "First command", "Command1"); JumpListManager.AddCategorySelfLink("Commands", "Second command", "Command2"); JumpListManager.AddCategorySelfLink("Commands", "Third command", "Command3"); JumpListManager.AddCategoryLink("Links", "Around and About .NET World", "http://blogs.ugidotnet.org/marcom", "shell32.dll", 220); JumpListManager.AddTaskLink("Start Notepad", "notepad.exe", "notepad.exe"); JumpListManager.AddTaskLink("Start Calculator", "calc.exe", "calc.exe"); JumpListManager.AddTaskLink("Start Paint", "mspaint.exe", "mspaint.exe"); JumpListManager.Refresh(); }
private void RebindProfiles() { ClearProfilesList(); foreach (ClientProfile p in JinxBotConfiguration.Instance.Profiles) { ToolStripMenuItem tsmi = new ToolStripMenuItem(p.ProfileName); tsmi.Tag = p; tsmi.Click += new EventHandler(tsmi_Click); tsmi.Image = UiIconProvider.GetIconForClient(p.Client); this.profilesToolStripMenuItem.DropDownItems.Add(tsmi); } JumpListManager.RefreshJumpList(JinxBotConfiguration.Instance.Profiles); }
private static void InitJumpList() { if (Utils.IsWin7OrLater) { try { Windows7Taskbar.SetCurrentProcessAppId(PreferencesFactory.get().getProperty("application.name")); _jumpListManager = new JumpListManager(PreferencesFactory.get().getProperty("application.name")); _jumpListManager.UserRemovedItems += (o, e) => { }; } catch (Exception exception) { Logger.warn("Exception while initializing jump list", exception); } } }
private void Main_Activated(object sender, EventArgs e) { Button_EditClient.Enabled = false; Button_DeleteClient.Enabled = false; Button_RunClient.Enabled = false; ClientList.Items.Clear(); DataTable dt = ClientDAL.GetAllClient(); for (int i = 0; i < dt.Rows.Count; i++) { ClientList.Items.Add(dt.Rows[i]["region"] + " - " + dt.Rows[i]["name"] + " - " + dt.Rows[i]["locale"]); JumpListManager.AddCategorySelfLink("快速启动", dt.Rows[i]["locale"].ToString(), dt.Rows[i]["locale"].ToString()); } if (ClientList.Items.Count == 0) { ClientList.Items.Add("尚未添加客户端,请添加!"); ClientList.Enabled = false; } else { ClientList.Enabled = true; } }
public override async Task <IWorkbook> ConfigureAsync(Frame rootFrame) { if (rootFrame == null) { throw new ArgumentNullException(nameof(rootFrame)); } bool sendAnalytics = WinSettings.Instance.GetValue <bool>(CoreSettings.SendAnalytics); string deviceId = "n/a"; try { var settings = WinSettings.Instance; if (!settings.HasValue(CoreSettings.DeviceId) || settings.GetValue <string>(CoreSettings.DeviceId) == "N/A") { string id = this.ComputeDeviceId(); settings.SetValue(CoreSettings.DeviceId, id); } deviceId = settings.GetValue <string>(CoreSettings.DeviceId); } catch (Exception ex) { TrackingManagerHelper.Exception(ex, "Error while setting device id"); } var platformService = new PlatformService(this.version, deviceId, () => CrashHandler.GetDiagnosticsInformation()); Ioc.RegisterInstance <IPlatformService, PlatformService>(platformService); TrackingManager trackingManager = new TrackingManager(sendAnalytics, platformService.DeviceFamily); Ioc.RegisterInstance <ITrackingManager, TrackingManager>(trackingManager); HttpClientHandler.Setup(); ResourcesLocator.Initialize("ms-appx://", UriKind.Absolute); if (!WinSettings.Instance.GetValue <bool>(CoreSettings.UseDarkTheme)) { ResourcesLocator.UpdateTheme(true); } var persistence = Ioc.RegisterInstance <IPersistenceLayer, WinPersistenceLayer>(new WinPersistenceLayer(automaticSave: true)); LogService.Log("Bootstraper", string.Format("Version: {0}", ApplicationVersion.GetAppVersion())); var navigationService = new NavigationService(rootFrame, platformService); Ioc.RegisterInstance <INavigationService, NavigationService>(navigationService); var messageBoxService = new MessageBoxService(navigationService); Ioc.RegisterInstance <IMessageBoxService, MessageBoxService>(messageBoxService); Ioc.RegisterInstance <ISpeechService, SpeechService>(new SpeechService(messageBoxService)); var workbook = this.InitializeWorkbook(persistence, platformService); // we just read the latest value of data from the DB, so even if there was a background sync // we now have the latest version, so we remove the background sync flag here workbook.Settings.SetValue(CoreSettings.SyncBackgroundOccured, false); this.keyboardShortcutManager = new KeyboardShortcutManager(workbook, rootFrame, navigationService, trackingManager); var backgroundTaskManager = new BackgroundTaskManager(workbook); backgroundTaskManager.InitializeAsync(); Ioc.RegisterInstance <IBackgroundTaskManager, BackgroundTaskManager>(backgroundTaskManager); var notificationService = new NotificationService(); Ioc.RegisterInstance <INotificationService, NotificationService>(notificationService); var startupManager = Ioc.Build <StartupManager>(); Ioc.RegisterInstance <IStartupManager, StartupManager>(startupManager); Ioc.RegisterInstance <IAlarmManager, AlarmManager>(new AlarmManager(workbook)); var tileManager = new TileManager(workbook, trackingManager, notificationService, false); tileManager.LoadSecondaryTilesAsync(); Ioc.RegisterInstance <ITileManager, TileManager>(tileManager); var synchronizationManager = await InitializeSyncAsync(workbook, platformService, trackingManager); // it is important to remove old task after sync is initialized otherwise changes would not // tracked and put in the changelog for the next sync workbook.RemoveOldTasks(); var cortanaService = new CortanaRuntimeService(workbook); // no need to await this call because it can runs in the background Task.Run(() => { JumpListManager.SetupJumpListAsync(); cortanaService.SetupDefinitionsAsync(); }); Ioc.RegisterInstance <ICortanaRuntimeService, CortanaRuntimeService>(cortanaService); return(workbook); }
protected async void OnLaunchedOrActivated(IActivatedEventArgs e) { var rootFrame = Window.Current.Content as Frame; Tuple <int, string> navArgs = null; Tuple <PageIndex, object> fullNavArgs = null; var launchArgs = e as LaunchActivatedEventArgs; if (!string.IsNullOrWhiteSpace(launchArgs?.Arguments)) { if (Regex.IsMatch(launchArgs.Arguments, @"[OpenUrl,OpenDetails];.*")) { var options = launchArgs.Arguments.Split(';'); if (options[0] == TileActions.OpenUrl.ToString()) { LaunchUri(options[1]); } else if (launchArgs.Arguments.Contains('|')) //legacy { var detailArgs = options[1].Split('|'); navArgs = new Tuple <int, string>(int.Parse(detailArgs[0]), detailArgs[1]); } else { fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(options[1]); } } else { fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(launchArgs.Arguments); } } else if (e is ProtocolActivatedEventArgs) { fullNavArgs = MalLinkParser.GetNavigationParametersForUrl("https:" + (e as ProtocolActivatedEventArgs).Uri.OriginalString.Replace("malclient://", "")); } else { var activationArgs = e as ToastNotificationActivatedEventArgs; if (activationArgs != null) { var arg = activationArgs.Argument; var pos = arg.IndexOf('~'); if (pos != -1) { var id = arg.Substring(0, pos); arg = arg.Substring(pos + 1); MalNotificationsQuery.MarkNotifiactionsAsRead(new MalNotification(id)); } if (arg.Contains(";")) { var options = activationArgs.Argument.Split(';'); if (options[0] == TileActions.OpenUrl.ToString()) { LaunchUri(options[1]); } } else { fullNavArgs = MalLinkParser.GetNavigationParametersForUrl(arg); } } } // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //nothing } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (navArgs != null) { MainViewModelBase.InitDetails = navArgs; } else if (fullNavArgs != null) { MainViewModelBase.InitDetailsFull = fullNavArgs; } rootFrame.Navigate(typeof(MainPage)); } else if (navArgs != null) { ViewModelLocator.GeneralMain.Navigate(PageIndex.PageAnimeDetails, new AnimeDetailsPageNavigationArgs(navArgs.Item1, navArgs.Item2, null, null)); } if (_initialized && fullNavArgs != null) { ViewModelLocator.GeneralMain.Navigate(fullNavArgs.Item1, fullNavArgs.Item2); } // Ensure the current window is active if (_initialized) { return; } InitializationRoutines.InitApp(); NotificationTaskManager.StartNotificationTask(BgTasks.ToastActivation, false); NotificationTaskManager.StartNotificationTask(BgTasks.Notifications, false); NotificationTaskManager.OnNotificationTaskRequested += NotificationTaskManagerOnOnNotificationTaskRequested; LiveTilesManager.LoadTileCache(); ImageCache.PerformScheduledCacheCleanup(); Window.Current.Activate(); RateReminderPopUp.ProcessRatePopUp(); JumpListManager.InitJumpList(); var tb = ApplicationView.GetForCurrentView().TitleBar; tb.BackgroundColor = tb.ButtonBackgroundColor = tb.InactiveBackgroundColor = tb.ButtonInactiveBackgroundColor = Settings.SelectedTheme == (int)ApplicationTheme.Dark ? Color.FromArgb(255, 41, 41, 41) : Colors.White; ProcessUpdate(); StoreLogoWorkaroundHacker.Hack(); _initialized = true; }
private void InitializeTaskbarControls() { stopThumbnailButton = new ThumbnailToolBarButton(Properties.Resources.stop, "Detener"); stopThumbnailButton.Click += (sender, args) => { StopRadioStream(); }; stopThumbnailButton.Enabled = false; previousThumbnailButton = new ThumbnailToolBarButton(Properties.Resources.previous, "Sintonizar radio anterior"); previousThumbnailButton.Click += async(sender, args) => { if (_previousStreamUrl != null && _previousStreamDescription != null) { await PlayRadioStream(_previousStreamUrl, _previousStreamDescription); } }; muteThumbnailButton = new ThumbnailToolBarButton(Properties.Resources.speaker, "Silenciar"); muteThumbnailButton.Click += (sender, args) => { MuteRadioStream(); }; TaskbarManager.Instance.ThumbnailToolBars.AddButtons(Handle, stopThumbnailButton, previousThumbnailButton, muteThumbnailButton); JumpListCommandReceived += (sender, e) => { CheckLineArguments(e.CommandName); }; Shown += (sender, e) => { string categoryName = "Radios"; char commandPrefix = '-'; foreach (KeyValuePair <string, Radio> radio in RadioGroup.Stations) { JumpListManager.AddCategorySelfLink( categoryName, radio.Value.Description, commandPrefix + radio.Key, radio.Value.Icon, 0 ); } JumpListManager.Refresh(); if (_args.Length > 1) { foreach (KeyValuePair <string, Radio> radio in RadioGroup.Stations) { if (_args[1] == radio.Value.Command) { CheckLineArguments(commandPrefix + radio.Key); } } } }; }
private void MainForm_Shown(object sender, EventArgs e) { JumpListManager.AddCategoryLink("链接", "星际争霸2战术资源站", "http://sc2.haoest.com", "shell32.dll", 220); JumpListManager.Refresh(); }
private static void ProcessAppArgs(Hashtable args) { if (args["device"] is string str && !_phase2InitComplete) { char[] chArray = new char[1] { '"' }; SyncControls.Instance.SetCurrentDeviceByCanonicalName(str.Trim(chArray)); } if (args["link"] is string link && !ZuneUI.Shell.IgnoreAppNavigationsArgs) { ZuneUI.Shell.ProcessExternalLink(link); } if (args["ripcd"] is string playCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs) { CDAccess.HandleDiskFromAutoplay(playCdPath, CDAction.Rip); } if (args["playcd"] is string ripCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs) { CDAccess.HandleDiskFromAutoplay(ripCdPath, CDAction.Play); } if (args["playmedia"] is string initialUrl && !ZuneUI.Shell.IgnoreAppNavigationsArgs) { RegisterNewFileEnumeration(new LaunchFromShellHelper("play", initialUrl)); } if (args["shellhlp_v2"] is string taskName && !ZuneUI.Shell.IgnoreAppNavigationsArgs) { string marshalledDataObject = args["dataobject"] as string; string eventName = args["event"] as string; if (marshalledDataObject != null && eventName != null) { RegisterNewFileEnumeration(new LaunchFromShellHelper(taskName, marshalledDataObject, eventName)); } } if (args.Contains("refreshlicenses")) { ZuneLibrary.MarkAllDRMFilesAsNeedingLicenseRefresh(); } if (args.Contains("update")) { SoftwareUpdates.Instance.InstallUpdates(); } if (args.Contains("shuffleall") && !ZuneUI.Shell.IgnoreAppNavigationsArgs) { SingletonModelItem <TransportControls> .Instance.ShuffleAllRequested = true; } if (args.Contains("resumenowplaying") && !ZuneUI.Shell.IgnoreAppNavigationsArgs) { SingletonModelItem <TransportControls> .Instance.ResumeLastNowPlayingHandler(); } if (args.Contains("refreshcontentandexit")) { if (!_phase2InitComplete) { HRESULT sOk = HRESULT._S_OK; HRESULT hr = ContentRefreshTask.Instance.StartContentRefresh(new AsyncCompleteHandler(OnContentRefreshTaskComplete)); if (hr.IsError) { OnContentRefreshTaskComplete(hr); } } else { ZuneLibrary.MarkAllDRMFilesAsNeedingLicenseRefresh(); } } if (!(args["playpin"] is string pinString) || ZuneUI.Shell.IgnoreAppNavigationsArgs) { return; } JumpListManager.PlayPin(JumpListPin.Parse(pinString)); }