コード例 #1
0
ファイル: FullReader.cs プロジェクト: easably/easy2learn
        void List_SelectedValueChanged(object sender, EventArgs e)
        {
            if (!this.Created)
            {
                return;
            }
            if (this.TwinList.ListEn.miShowOnlyWithWordsToolStripMenuItem.Checked)
            { // without indent
                if (this.TwinList.ListEn.CurrentSentence != null)
                {
                    this.TwinList.ListNative.SafeSelectedIndex = this.TwinList.ListEn.CurrentSentence.Index;
                }
            }
            else
            {
                this.TwinList.ListNative.SetSafeSelectedIndexWithIndent(this.TwinList.ListEn.List.SelectedIndex, this.TwinList.ListEn.CurrentSentence);
            }

            //  if (!this.TwinList.ListEn.IsOnlySynch)
            this.TwinList.HTMLScroller_SelectedIndex = this.TwinList.ListEn.CurrentSentence.Index - 1;

            if (this.TwinText.textForeignAndTran.Sentence != this.TwinList.ListEn.CurrentSentence)
            {
                this.TwinText.textForeignAndTran.Sentence = this.TwinList.ListEn.CurrentSentence;
            }


            Windows7Taskbar.CalculateAndSet(this.Parent.Handle, this.TwinList.ListEn.List.Items.Count, this.TwinList.ListEn.List.SelectedIndex);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: webdes27/game-updater
        private void updateProgressBarUnsafe(int pe, bool total)
        {
            if (pe < 0)
            {
                pe = 0;
            }

            if (pe > 100)
            {
                pe = 100;
            }

            if (total)
            {
                if (pe == 0)
                {
                    Windows7Taskbar.SetProgressState(Handle, ThumbnailProgressState.NoProgress);
                }
                else
                {
                    Windows7Taskbar.SetProgressValue(Handle, pe, 100);
                }

                _totalProgress.Value = pe;
                //_totalProgress.Refresh();
            }
            else
            {
                _fileProgressBar.Value = pe;
                //_fileProgressBar.Refresh();
            }
        }
コード例 #3
0
        void ChangeStatus(string Status, int ProgressValue)
        {
            statusStrip1.Invoke(new Action(() =>
            {
                toolStripProgressBar1.Value = ProgressValue;
                toolStripStatusLabel1.Text  = Status;
            }));

            if (Utils.IsWindows7OrSuperior())
            {
                this.Invoke(new Action(() =>
                {
                    if (ProgressValue > 0)
                    {
                        Windows7Taskbar.SetProgressState(Handle, Windows7Taskbar.ThumbnailProgressState.Normal);
                    }
                    else
                    {
                        Windows7Taskbar.SetProgressState(Handle, Windows7Taskbar.ThumbnailProgressState.NoProgress);
                    }

                    Windows7Taskbar.SetProgressValue(Handle, (ulong)ProgressValue, (ulong)PatchInfo.ProgressBarMaxValue);
                }));
            }
        }
コード例 #4
0
 /// <summary>
 /// Sets the progress bar of this form's taskbar button to the
 /// specified percentage.
 /// </summary>
 /// <param name="form">The form.</param>
 /// <param name="percent">The progress percentage.</param>
 public static void SetTaskbarProgress(this Form form, float percent)
 {
     Windows7Taskbar.SetProgressState(
         form.Handle, Windows7Taskbar.ThumbnailProgressState.Normal);
     Windows7Taskbar.SetProgressValue(
         form.Handle, (ulong)percent, 100);
 }
コード例 #5
0
        internal void updateProgress(int current, int total, string caption)
        {
            caption += "...";
            if (label1.Text != caption)
            {
                label1.Text = caption;
                return;
            }
            if (progressBar1.Maximum != total)
            {
                progressBar1.Maximum = total;
            }
            progressBar1.Value = current;
            if (progressBar1.Visible == false)
            {
                progressBar1.Visible = true;
            }

            if (taskHwnd == null)
            {
                taskHwnd = Windows7Taskbar.GetTaskBarForm(this);
            }

            if (taskHwnd.Value != IntPtr.Zero)
            {
                Windows7Taskbar.SetProgressValue(taskHwnd.Value, (uint)current, (uint)total);
            }
        }
コード例 #6
0
 public MainForm()
 {
     InitializeComponent();
     Windows7Taskbar.AllowTaskbarWindowMessagesThroughUIPI();
     Windows7Taskbar.SetCurrentProcessAppId("TaskbarManaged");
     setActiveMon(new CPUMonitor());
 }
コード例 #7
0
        public static void ShowError(Form f, Exception e, string url = null)
        {
            WaitCursor.Reset();
            if (e is MessageException)
            {
                Windows7Taskbar.SetStatus(f, ProgressBarState.Pause);
                ShowInfoMessage(f, e.Message);
                Windows7Taskbar.SetStatus(f, ProgressBarState.Normal);
                return;
            }
            string err = "";

            if (url != null)
            {
                err = "URL: " + url + Environment.NewLine;
            }
            err += "Se ha producido un error: " + e.Message;

            if (e.InnerException != null)
            {
                err += "\n\nInnerException: " + e.InnerException.Message;
            }
#if DEBUG
            err += "\n\n" + e.ToString();
            if (e.InnerException != null)
            {
                err += "\n\nInnerException: " + e.InnerException.ToString();
            }
#endif
            Windows7Taskbar.SetStatus(f, ProgressBarState.Error);
            MessageBox.Show(f, err, "Atención", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
            Windows7Taskbar.SetStatus(f, ProgressBarState.Normal);
        }
コード例 #8
0
        private void SetClip()
        {
            int   index = rtbText.GetFirstCharIndexOfCurrentLine();
            Point point = rtbText.GetPositionFromCharIndex(index);

            Windows7Taskbar.SetThumbnailClip(Handle, new Rectangle(point, new Size(200, 119)));
        }
コード例 #9
0
ファイル: DocumentReader.cs プロジェクト: mehome/cs
 private void btnRegisterAssociation_Click(object sender, EventArgs e)
 {
     RegistrationHelper.RegisterFileAssociations(
         APP_ID, false, Windows7Taskbar.GetCurrentProcessAppId(),
         Assembly.GetExecutingAssembly().Location + " /doc:%1",
         ".rtf");
 }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: klange/acoustics-windows
        public MainForm()
        {
            InitializeComponent();
            Windows7Taskbar.AllowTaskbarWindowMessagesThroughUIPI();
            Windows7Taskbar.SetCurrentProcessAppId("AcousticsTaskbar");

            Reinit();
        }
コード例 #11
0
        public void onStart(int max)
        {
            StatusProgress.Minimum = 0;
            StatusProgress.Maximum = max;
            StatusProgress.Visible = true;

            Windows7Taskbar.SetProgressState(Handle, ThumbnailProgressState.Normal);
        }
コード例 #12
0
        public Windows7Form()
        {
            InitializeComponent();

            Windows7Taskbar.AllowTaskbarWindowMessagesThroughUIPI();

            Windows7Taskbar.SetCurrentProcessAppId("TaskbarManaged");
            //string appId = Windows7Taskbar.GetCurrentProcessAppId();
        }
コード例 #13
0
 private void unregisterFileExtensionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     RegistrationHelper.UnregisterFileAssociations(
         progId,
         false,  //TODO: Access denied to HKCU\Software\Classes, check why
         Windows7Taskbar.GetCurrentProcessAppId(),
         Assembly.GetEntryAssembly().Location + " /doc:%1",
         ".txt");
 }
コード例 #14
0
        internal CustomWindowsManager(ProxyWindow proxy, IntPtr hwndParent)
        {
            _hwnd        = proxy.RealWindow;
            _hwndParent  = hwndParent;
            _proxyWindow = proxy;//Just keep it alive
            _proxyWindow.WindowsManager = this;

            Windows7Taskbar.EnableCustomWindowPreview(WindowToTellDwmAbout);
        }
コード例 #15
0
        public void onEnd()
        {
            StatusProgress.Minimum = 0;
            StatusProgress.Maximum = 100;
            StatusProgress.Value   = 0;
            StatusProgress.Visible = false;

            Windows7Taskbar.SetProgressState(Handle, ThumbnailProgressState.NoProgress);
        }
コード例 #16
0
        public void onEnd()
        {
            _totalProgress.Minimum = 0;
            _totalProgress.Maximum = 100;
            _totalProgress.Value   = 0;

            Windows7Taskbar.SetProgressState(Handle, ThumbnailProgressState.NoProgress);

            MessageBox.Show(this, "Done", "Premaker", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
 private void setPreview(string fileLocation)
 {
     if (!string.IsNullOrEmpty(fileLocation))
     {
         using (Image coverArt = Image.FromFile(fileLocation))
         {
             Windows7Taskbar.SetIconicThumbnail((IntPtr)mcRef.GetWindowHandle(), (Bitmap)coverArt.GetThumbnailImage(120, 120, null, IntPtr.Zero));
         }
         return;
     }
 }
コード例 #18
0
        private void ChangeProgress(int progress)
        {
            uploadedLabel.Text = "Uploaded: " + Utils.FormatSize(bytesTransferred) +
                                 " (" + ((double)bytesTransferred * 100 / totalFileSize).ToString("F2") + "%)";
            totalSizeLabel.Text  = "Total Size: " + Utils.FormatSize(totalFileSize);
            speedLabel.Text      = "Speed: " + Utils.FormatSize(bytesPerSecond) + "/s";
            progressUpload.Value = progress;

            if (OSVersion.HasExtendedTaskbar)
            {
                Windows7Taskbar.SetTaskbarProgress(Program.HackerWindow, this.progressUpload);
            }
        }
コード例 #19
0
        /// <summary>
        /// Sets the progress bar in the containing form's taskbar button
        /// to this progress bar's progress.
        /// </summary>
        /// <param name="progressBar">The progress bar.</param>
        public static void SetTaskbarProgress(this ProgressBar progressBar)
        {
            Form form = (Form)progressBar.TopLevelControl;

            //Approximation:
            ulong maximum  = (ulong)(progressBar.Maximum - progressBar.Minimum);
            ulong progress = (ulong)(progressBar.Value - progressBar.Minimum);

            Windows7Taskbar.SetProgressState(
                form.Handle, Windows7Taskbar.ThumbnailProgressState.Normal);
            Windows7Taskbar.SetProgressValue(
                form.Handle, progress, maximum);
        }
 private void setWindowsPeak()
 {
     if (!windowMinimized)
     {
         GetWindowRect((IntPtr)mcRef.GetWindowHandle(), ref windowsize);
         ScreenCapture.GrabWindowBitmap((IntPtr)mcRef.GetWindowHandle(), windowsize.Size, out screen);
         screen.RotateFlip(RotateFlipType.Rotate180FlipX);
     }
     if (screen != null)
     {
         Windows7Taskbar.SetPeekBitmap((IntPtr)mcRef.GetWindowHandle(), screen, false);
     }
     GC.Collect();
 }
コード例 #21
0
 public void UpdateOverallProgressState(long progress, long maximum)
 {
     if (Utils.IsWin7OrLater)
     {
         if (progress == 0 || maximum == 0)
         {
             Windows7Taskbar.SetProgressState(Handle, Windows7Taskbar.ThumbnailProgressState.NoProgress);
         }
         else
         {
             Windows7Taskbar.SetProgressState(Handle, Windows7Taskbar.ThumbnailProgressState.Normal);
             Windows7Taskbar.SetProgressValue(Handle, (ulong)progress, (ulong)maximum);
         }
     }
 }
コード例 #22
0
        private void VirusTotalUploaderWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (uploadTask != null)
            {
                uploadTask.Cancel();
            }

            if (OSVersion.HasExtendedTaskbar)
            {
                Windows7Taskbar.SetTaskbarProgressState(
                    Program.HackerWindowHandle,
                    Windows7Taskbar.ThumbnailProgressState.NoProgress
                    );
            }
        }
        private void setWindowTitle()
        {
            IMJPlaybackAutomation playback = mcRef.GetPlayback();

            if (playback.State != MJPlaybackStates.PLAYSTATE_STOPPED && displayArtistTrackName.Checked)
            {
                Windows7Taskbar.SetThumbnailTooltip((IntPtr)mcRef.GetWindowHandle(), nowPlayingFile.Artist + " - " + nowPlayingFile.Name);
                SetWindowText((IntPtr)mcRef.GetWindowHandle(), nowPlayingFile.Artist + " - " + nowPlayingFile.Name);
            }
            else
            {
                SetWindowText((IntPtr)mcRef.GetWindowHandle(), oldWindowText.ToString());
                Windows7Taskbar.SetThumbnailTooltip((IntPtr)mcRef.GetWindowHandle(), oldWindowText.ToString());
            }
        }
コード例 #24
0
ファイル: MainController.cs プロジェクト: wangkesen/cyberduck
 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);
         }
     }
 }
コード例 #25
0
ファイル: DocumentReader.cs プロジェクト: mehome/cs
        private void DocumentReader_Load(object sender, EventArgs e)
        {
            //
            Windows7Taskbar.SetCurrentProcessAppId(APP_ID);

            rtbText.Text = "Mary had a little lamb,\r\nHer fur as white as snow,\r\nAnd everywhere that Mary went,\r\nThe lamb was sure to go.\r\n\r\n";
            for (int i = 0; i < 5; ++i)
            {
                rtbText.Text = rtbText.Text + rtbText.Text;
            }

            if (Environment.CommandLine.Contains("/doc"))
            {
                string doc = Environment.CommandLine.Substring(
                    Environment.CommandLine.IndexOf("/doc") + "/doc".Length + 1);
                rtbText.LoadFile(doc);
            }
        }
コード例 #26
0
 private void sendFileToolStripMenuItem_Click(object sender, EventArgs e)
 {
     sendFileTimer.Interval = 1000;
     sendFileTimer.Tick    += delegate
     {
         _percentFileCompleted += 10;
         if (_percentFileCompleted == 100)
         {
             sendFileTimer.Stop();
             MessageBox.Show("File operation failed!");
             Windows7Taskbar.SetProgressState(Handle, Windows7Taskbar.ThumbnailProgressState.Error);
             _percentFileCompleted = 0;
         }
         else
         {
             Windows7Taskbar.SetProgressValue(Handle, (ulong)_percentFileCompleted, (ulong)100);
         }
     };
     sendFileTimer.Start();
 }
コード例 #27
0
        public void readDirectory(String dir)
        {
            ThreadStart dele = delegate
            {
                Windows7Taskbar.SetProgressState(Handle, ThumbnailProgressState.Indeterminate);
                Enabled = false;

                List <String> list = new List <string>();

                read(list, dir);

                foreach (string s in list)
                {
                    addFile(s);
                }

                Windows7Taskbar.SetProgressState(Handle, ThumbnailProgressState.NoProgress);
                Enabled = true;
            };
            Thread t = new Thread(dele);

            t.Start();
        }
コード例 #28
0
        void List_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                this.keyBoards.Freeze();
                this.textArea.Sentence = this.tutorList1.CurrentSentence;
                // this.txBox.Text = this.tutorList1.CurrentSentence.ToString();
            }
            finally
            {
                this.keyBoards.UnFreeze();
            }

            int startInd = this.txBox.Text.IndexOf(SentenceForTutor.CharHided);

            if (startInd != -1)
            {
                this.txBox.SelectionStart  = startInd;
                this.txBox.SelectionLength = 1;
            }

            int i = 0;

            foreach (Sentence sent in this.tutorList1.Sentences)
            {
                if (!(sent is SentenceForTutor))
                {
                    continue;
                }
                if (((SentenceForTutor)sent).IsGuessed)
                {
                    ++i;
                }
            }
            Windows7Taskbar.CalculateAndSet(this.Handle, this.tutorList1.List.Items.Count, i);
        }
コード例 #29
0
 /// <summary>
 /// Sets the progress bar of this form's taskbar button to the
 /// specified state.
 /// </summary>
 /// <param name="form">The form.</param>
 /// <param name="state">The taskbar progress state.</param>
 public static void SetTaskbarProgressState(this Form form, Windows7Taskbar.ThumbnailProgressState state)
 {
     Windows7Taskbar.SetProgressState(form.Handle, state);
 }
コード例 #30
0
        public void setValue(int v)
        {
            _totalProgress.Value = v;

            Windows7Taskbar.SetProgressValue(Handle, v, 100);
        }
コード例 #31
0
 public void onStart()
 {
     _totalProgress.Minimum = 0;
     Windows7Taskbar.SetProgressState(Handle, ThumbnailProgressState.Normal);
 }
 /// <summary>
 /// Sets the progress bar of this Window's taskbar button to the
 /// specified state.
 /// </summary>
 /// <param name="form">The form.</param>
 /// <param name="state">The taskbar progress state.</param>
 public static void SetTaskbarProgressState(this Window form, Windows7Taskbar.ThumbnailProgressState state)
 {
     Windows7Taskbar.SetProgressState(GetWindowHandle(form), state);
 }