public DummyForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // // // Kommandozeilen Parameter abfangen und verarbeiten // -Hostfile="PfadZurListeMitHostAdresse" // -Damware="PfadZurDameWareExe" --- Wenn abweichend von Standard Installationspfad // -Checkliste="Pfad zur xls Checkliste" // if (!string.IsNullOrWhiteSpace(Environment.CommandLine)) { Debug.WriteLine(Environment.CommandLine.ToString(), "Programm Start Parameter"); strSourceFile = ParseCmdLineParam("sourcefile", Environment.CommandLine); } // // Funktionen der Win7 Taskbar nutzen // tm = TaskbarManager.Instance; tm.ApplicationId = "CSV - SuchTool"; }
public static void UpdateProgressUI() { bool isTasksWorking = false; double averageProgress = 0; IEnumerable <WorkerTask> workingTasks = Tasks.Where(x => x != null && x.Status == TaskStatus.Working && x.Info != null); if (workingTasks.Count() > 0) { isTasksWorking = true; workingTasks = workingTasks.Where(x => x.Info.Progress != null); if (workingTasks.Count() > 0) { averageProgress = workingTasks.Average(x => x.Info.Progress.Percentage); } } if (isTasksWorking) { Program.MainForm.Text = string.Format("{0} - {1:0.0}%", Program.Title, averageProgress); UpdateTrayIcon((int)averageProgress); TaskbarManager.SetProgressValue(Program.MainForm, (int)averageProgress); } else { Program.MainForm.Text = Program.Title; UpdateTrayIcon(-1); TaskbarManager.SetProgressState(Program.MainForm, TaskbarProgressBarStatus.NoProgress); } }
/// <summary> /// Initializes a new instance of the <see cref="Win7"/> class. /// </summary> public Win7() { if (IsWindowsSeven) { windowsTaskbar = TaskbarManager.Instance; } }
private void InitTaskbar(bool init) { if (init) { taskbar = TaskbarManager.Instance; taskbarPlayPause = new ThumbnailToolBarButton(Resources.Play, "Play"); taskbarStop = new ThumbnailToolBarButton(Resources.Stop, "Stop"); taskbarClipboard = new ThumbnailToolBarButton(Resources.PlayClipboard, "Play Clipboard"); taskbarClipboard.Click += buttonPlayClipboard_Click; taskbarPlayPause.Click += onTaskbarPlayPause_Click; taskbarStop.Click += buttonStop_Click; taskbarButtons = new ThumbnailToolBarButton[] { taskbarClipboard, taskbarPlayPause, taskbarStop }; taskbar.ThumbnailToolBars.AddButtons(Handle, taskbarButtons); } else { taskbar = null; taskbarPlayPause = null; taskbarStop = null; taskbarClipboard = null; taskbarButtons = null; } }
public async static Task <bool> RequestPinSecondaryTileToTaskbar(string tileName, string displayname) { if (ApiInformation.IsMethodPresent("Windows.UI.Shell.TaskbarManager", "RequestPinSecondaryTileAsync")) { // API present! // Unlock the pin to taskbar feature var result = LimitedAccessFeatures.TryUnlockFeature( "com.microsoft.windows.secondarytilemanagement", "<tokenFromMicrosoft>", "<publisher> has registered their use of com.microsoft.windows.secondarytilemanagement with Microsoft and agrees to the terms of use."); // If unlock succeeded if ((result.Status == LimitedAccessFeatureStatus.Available) || (result.Status == LimitedAccessFeatureStatus.AvailableWithoutToken)) { if (!SecondaryTile.Exists(tileName)) { SecondaryTile tile = new SecondaryTile(SanitizedTileName(displayname).Replace("!", "")); tile.DisplayName = displayname; tile.Arguments = SanitizedTileName(tileName); tile.VisualElements.Square44x44Logo = new Uri("ms-appx:///Assets/Square44x44Logo.scale-100.png"); tile.VisualElements.Square150x150Logo = new Uri("ms-appx:///Assets/Square150x150Logo.scale-100.png"); tile.VisualElements.ShowNameOnSquare150x150Logo = true; return(await TaskbarManager.GetDefault().RequestPinSecondaryTileAsync(tile)); } } } return(true); }
private void SetProgress(double multiple = -1) { Dispatcher.Invoke(() => { if (multiple >= 0 && multiple <= 1) // Change { int percent = Convert.ToInt32(Math.Round(multiple * 100)); SetTitleSuffix(percent + "%"); TaskProgressBar.Value = percent; TaskbarManager.SetProgressValue(percent, 100); TaskbarManager.SetProgressState(TaskbarProgressBarState.Normal); } else if (multiple == -1) // Reset { SetTitleSuffix(); TaskProgressBar.Value = 0; TaskbarManager.SetProgressValue(0, 100); TaskbarManager.SetProgressState(TaskbarProgressBarState.NoProgress); } else { throw new ArgumentException(); } }); }
private void StartGame() { this.AddTextToList("Das Spiel wird gestartet.\r\n"); Process proc = new Process(); proc.StartInfo.FileName = Config.BinaryName; proc.StartInfo.UseShellExecute = false; try { proc.Start(); } catch { MessageBox.Show(String.Format("Die Datei {0} existiert nicht.", Config.BinaryName), "Fehler", MessageBoxButton.OK, MessageBoxImage.Error); } if (this.IsWin7OrHigher()) { TaskbarManager tbmanager = TaskbarManager.Instance; tbmanager.SetProgressState(TaskbarProgressBarState.NoProgress); } BtnPlay.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new System.Windows.Threading.DispatcherOperationCallback(delegate { BtnPlay.IsEnabled = true; return(null); }), null); }
/// <summary> /// Creates the recently used ports jumplist /// </summary> private void CreateJumpList() { taskBarManager = TaskbarManager.Instance; if (TaskbarManager.IsPlatformSupported) { string currentDir = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName; JumpList list = JumpList.CreateJumpList(); // Separate by service hosts the recent ports. Port.GetUsedPorts().GroupBy(p => p.ServiceHost).ToList().ForEach(group => { JumpListCustomCategory userActionsCategory = new JumpListCustomCategory(group.Key); group.OrderByDescending(p => p.UsedTimes).ToList().ForEach(port => { JumpListLink userActionLink = new JumpListLink(Assembly.GetEntryAssembly().Location, string.Format("{0} @ {1}", port.Number.ToString(), port.Host)) { Arguments = port.Id.ToString(), IconReference = new IconReference(currentDir + "\\Resources\\tunnel-jump.ico,0") }; userActionsCategory.AddJumpListItems(userActionLink); }); list.AddCustomCategories(userActionsCategory); }); list.Refresh(); } }
/// <summary> /// Show progress on taskbar /// </summary> /// <param name="i">index</param> /// <param name="ii">size</param> internal static void Progress(int i, int ii) { TaskbarManager prog = TaskbarManager.Instance; prog.SetProgressState(TaskbarProgressBarState.Normal); prog.SetProgressValue(i, ii); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); appMutex = new Mutex(true, AppName, out bool newMutexCreated); if (!newMutexCreated) { Shutdown(); return; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; configurationManager = new ConfigurationManager(); configurationManager.Changed += ConfigurationManager_Changed; ConfigurationManager_Changed(configurationManager.ConfigFile); if (configurationManager.ConfigFile.AutoUpdate) { var updateManager = new UpdateManager(AppOwner, AppName); updateManager.CheckForNewVersion(); } windowManager = new WindowManager(configurationManager); shortcutManager = new ShortcutManager(configurationManager, windowManager); taskbarManager = new TaskbarManager(configurationManager); notifyIcon = (TaskbarIcon)FindResource("NotifyIcon"); }
public Updater(string Status, int Max, string MapPath) { InitializeComponent(); // Set Max this.progressBarControl2.Properties.Maximum = Max; try { taskbar = TaskbarManager.Instance; taskbar.SetProgressValue(0, Max); } catch { } this.Max = Max; // Set Message lblStatus.Text = Status; lblInfo.Location = new Point(lblStatus.Location.X + lblStatus.Size.Width + 10, lblInfo.Location.Y); // Setup background worker this.MapPath = MapPath; backgroundWorker1 = new BackgroundWorker(); backgroundWorker1.WorkerReportsProgress = true; backgroundWorker1.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork); backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted); backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged); }
public frmMain(bool isGod) { mGodMode = isGod; mWin7Taskbar = TaskbarManager.Instance; LayoutManager.Layout = Properties.Settings.Default.Layout; InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="Win7"/> class. /// </summary> public Win7() { if (this.IsWindowsSeven) { this.windowsTaskbar = TaskbarManager.Instance; this.windowsTaskbar.ApplicationId = "HandBrake"; } }
public static void Init(Form form) { if (TaskbarManager.IsPlatformSupported) { WindowsTaskbar = TaskbarManager.Instance; WindowsTaskbar.ApplicationId = TaskbarHelper.appId; WindowHandle = form.Handle; } }
public WindowManagerDecorator(DockIconContainer _container) { container = _container; Application.Current.Exit += Current_Exit; WindowManager.Manager.WindowAdded += Manager_WindowAdded; WindowManager.Manager.WindowRemoved += Manager_WindowRemoved; WindowManager.Manager.Start(); TaskbarManager.SetTaskbarVisibility(false); }
public async Task applyUpdate(ProgressBar progressbar, TaskbarManager taskbar) { taskbar.SetProgressState(TaskbarProgressBarState.Normal); double progress = 0; double targetProgress = updateTasks.Count; foreach (UpdateTask task in updateTasks) { progress++; string file = task.file; try { switch (task.operation) { case (UpdateOperations.create_directory): if (!Directory.Exists(file)) { await Task.Run(() => Directory.CreateDirectory(file)); } break; case UpdateOperations.remove: if (File.Exists(file)) { await Task.Run(() => File.Delete(file)); } else if (Directory.Exists(file)) { await Task.Run(() => Directory.Delete(file, true)); } break; case UpdateOperations.update: await Task.Run(() => webClient.DownloadFile(new Uri(host + file), file + ".download")); if (File.Exists(file)) { await Task.Run(() => File.Delete(file)); } File.Move(file + ".download", file); break; } progressbar.Value = progress / targetProgress * 100; taskbar.SetProgressValue(Convert.ToInt32(progress), Convert.ToInt32(targetProgress)); logPrint($"[{task.operation}] {task.file}"); } catch (Exception error) { logPrint($"Ошибка при выполнении операции: {error.Message}"); } } logPrint($"Применение обновлений завершено"); return; }
private void Window_Loaded(object sender, RoutedEventArgs e) { _manager = TaskbarManager.Instance; if (!_noShaders) { return; } Resources["DropShadowFx"] = null; Resources["BlurEffect"] = null; }
public static async Task <bool?> RequestPinToTaskBar() { if (IsPinToTaskBarEnabled) { return(await TaskbarManager.GetDefault().RequestPinCurrentAppAsync()); } else { return(null); } }
/// <summary> /// Converter Form. Based on code from nixx's WebMConverter. /// </summary> /// <param name="inFile">Path to input file</param> /// <param name="outFile">Path to output file</param> /// <param name="args">ffmpeg arguments without input and output files</param> /// <param name="inDuration">Video duration for progress</param> public ConverterForm(string inFile, string outFile, string[] args, double inDuration) { InitializeComponent(); inputFile = inFile; outputFile = outFile; arguments = args; duration = inDuration; taskbarManager = TaskbarManager.Instance; }
public async static Task <bool?> IsPinnedToTaskBar() { if (IsPinToTaskBarEnabled) { return(await TaskbarManager.GetDefault().IsCurrentAppPinnedAsync()); } else { return(null); } }
/// <summary> /// Constructs a new Windows 7 taskbar item object. /// </summary> /// <param name="windowHandle">Window handle.</param> /// <exception cref="PlatformNotSupportedException"> /// Thrown if the operating system is not Windows 7 or higher. /// </exception> public Windows7TaskbarItem(IntPtr windowHandle) { if (!IsPlatformSupported) { throw new PlatformNotSupportedException("This class requires Windows 7 or higher"); } #if !__MonoCS__ _taskbarManager = TaskbarManager.Instance; _windowHandle = windowHandle; #endif }
public MainWindow() { InitializeComponent(); this.IsEnabled = false; mWiggleStory = (Storyboard)cmbDisk.FindResource("ComboWiggleStory"); if (TaskbarManager.IsPlatformSupported) { mTaskbarManager = TaskbarManager.Instance; } }
private async Task Authenticate(string code) { try { TaskbarManager.SetProgressState(TaskbarProgressBarState.Indeterminate); var result = await OAuthFlower.MicrosoftCodeToAccessToken(code, CancelToken); var xbox_result = await XboxliveAuther.Authenticate(result, CancelToken); var mc_result = await McServices.Authenticate(xbox_result, CancelToken); var owner_result = await McServices.CheckHaveGameOwnership(mc_result, CancelToken); if (owner_result) { MicrosoftUser microsoftUser = await McServices.GetProfile(result, mc_result, CancelToken); LoggedInUser = microsoftUser; islogin = true; LoginChange(); } else { islogin = false; LoggedInUser = null; var res = await this.ShowMessageAsync(App.GetResourceString("String.OauthLogin.NoMinecraft"), App.GetResourceString("String.OauthLogin.NoMinecraft1"), MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings() { AffirmativeButtonText = App.GetResourceString("String.OauthLogin.Back"), NegativeButtonText = App.GetResourceString("String.OauthLogin.Change"), DefaultButtonFocus = MessageDialogResult.Negative }); if (res == MessageDialogResult.Negative) { LoginOut(); } } } catch (Exception ex) { LoggedInUser = null; await this.ShowMessageAsync(App.GetResourceString("String.OauthLogin.LoginError"), ex.ToString()); } finally { TaskbarManager.SetProgressState(TaskbarProgressBarState.NoProgress); } }
private async Task TryShowPinTeachingTip() { var tbmgr = TaskbarManager.GetDefault(); var isPinned = await tbmgr.IsCurrentAppPinnedAsync(); if (SystemInformation.Instance.IsFirstRun && ApiInformation.IsTypePresent("Windows.UI.Shell.TaskbarManager") && tbmgr.IsPinningAllowed && !isPinned) { PinTeachingTip.IsOpen = true; App.Services.GetRequiredService <ITelemetry>().TrackEvent(TelemetryConstants.LaunchMessageShown); } }
private void Downloader_DownloadProgressChanged(object sender, DownloadProgressChangedArg e) { Dispatcher.Invoke(new Action(() => { progressBar.Maximum = e.TaskCount; progressBar.Value = e.TaskCount - e.LastTaskCount; double progress = (e.TaskCount - e.LastTaskCount) / (double)e.TaskCount; if (progress > 0) { TaskbarManager.SetProgressValue((int)(progress * 100), 100, CriticalHandle); } progressPerTextBlock.Text = progress.ToString("0%"); Tasks.Remove(e.DoneTask); })); }
private async void ShowTaskbarTipIfNeeded() { try { // You should check if you've already shown this tip before, // and if so, don't show the tip to the user again. if (ApplicationData.Current.LocalSettings.Values.Any(i => i.Key.Equals("ShownTaskbarTip"))) { // But for purposes of this Quickstart, we'll always show the tip, // so we've commented out the return statement. //return; } // Store that you've shown this tip, so you don't show it again ApplicationData.Current.LocalSettings.Values["ShownTaskbarTip"] = true; // If Start screen manager API's aren't present if (!ApiInformation.IsTypePresent("Windows.UI.Shell.TaskbarManager")) { ShowMessage("TaskbarManager API isn't present on this build."); return; } // Get the taskbar manager var taskbarManager = TaskbarManager.GetDefault(); // If Taskbar doesn't allow pinning, don't show the tip if (!taskbarManager.IsPinningAllowed) { ShowMessage("Taskbar doesn't allow pinning (or Taskbar isn't supported on this device family)."); return; } // If already pinned, don't show the tip if (await taskbarManager.IsCurrentAppPinnedAsync()) { ShowMessage("This app is already pinned to Taskbar!"); return; } // Otherwise, show the tip FlyoutPinTip.ShowAt(ButtonShowTip); } catch (Exception ex) { ShowMessage(ex.ToString()); } }
private async void PinTeachingTip_ActionButtonClick(Microsoft.UI.Xaml.Controls.TeachingTip sender, object args) { sender.IsOpen = false; var tbmgr = TaskbarManager.GetDefault(); var isPinned = await tbmgr.IsCurrentAppPinnedAsync(); if (ApiInformation.IsTypePresent("Windows.UI.Shell.TaskbarManager") && tbmgr.IsPinningAllowed && !isPinned) { await tbmgr.RequestPinCurrentAppAsync(); App.Services.GetRequiredService <ITelemetry>().TrackEvent(TelemetryConstants.PinnedToTaskbar); } }
public Engine() { CheckForUpdates(); Core.Initialize(); this.ConfigManager = new ConfigManager(); this.WallpaperManager = new WallpaperManager(); this._windowManager = new WindowManager(); this.TaskbarManager = new TaskbarManager(ConfigManager); this._icon = new NotifyIcon(); this._icon.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); this._icon.Click += openSettings; this._icon.DoubleClick += openSettings; this._icon.BalloonTipClicked += openSettings; }
public FrmExtract(RoGrfFile grf, string rootDir, ArrayList toExtract) { InitializeComponent(); mWin7Taskbar = TaskbarManager.Instance; mGrfFile = grf; mRootDir = rootDir; mToExtract = toExtract; mWorker = new BackgroundWorker(); mWorker.WorkerReportsProgress = true; mWorker.WorkerSupportsCancellation = true; mWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(mWorker_RunWorkerCompleted); mWorker.ProgressChanged += new ProgressChangedEventHandler(mWorker_ProgressChanged); mWorker.DoWork += new DoWorkEventHandler(mWorker_DoWork); }
private async void PinToTaskBar_Click(object sender, RoutedEventArgs e) { if (!ApiInformation.IsTypePresent("Windows.UI.Shell.TaskbarManager")) { await ShowMessageAsync("API requires Windows 10 version 16299 or newer."); return; } var taskbarManager = TaskbarManager.GetDefault(); if (!taskbarManager.IsSupported) { await ShowMessageAsync("Taskbar is not supported on this version of Windows 10."); return; } var isPinned = await taskbarManager.IsCurrentAppPinnedAsync(); if (isPinned) { await ShowMessageAsync("Application is already pinned."); return; } if (!taskbarManager.IsPinningAllowed) { await ShowMessageAsync("Pinning to task bar is not allowed on this PC."); return; } var pinned = await taskbarManager.RequestPinCurrentAppAsync(); if (pinned) { await ShowMessageAsync("App is successfully pinned!"); } else { await ShowMessageAsync("App was not pinned!"); } }