Represents a taskbar thumbnail button in the thumbnail toolbar.
상속: IDisposable
예제 #1
0
파일: Form1.cs 프로젝트: schrose/TimeTrack
        public Form1()
        {
            InitializeComponent();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(timer_Tick);
            day = 8 * 60;
            max = 100;
            that = this;

            ThumbnailToolBarButton oneButton = new ThumbnailToolBarButton(TimeTrack.Properties.Resources.one, "+1 Minute");
            oneButton.Click += button1_Click;

            ThumbnailToolBarButton fiveButton = new ThumbnailToolBarButton(TimeTrack.Properties.Resources.five, "+5 Minuten");
            fiveButton.Click += button2_Click;

            ThumbnailToolBarButton tenButton = new ThumbnailToolBarButton(TimeTrack.Properties.Resources.ten, "+10 Minuten");
            tenButton.Click += button3_Click;

            ThumbnailToolBarButton thirtyButton = new ThumbnailToolBarButton(TimeTrack.Properties.Resources.thirty, "+30 Minuten");
            thirtyButton.Click += button4_Click;

            ThumbnailToolBarButton sixtyButton = new ThumbnailToolBarButton(TimeTrack.Properties.Resources.sixty, "+60 Minuten");
            sixtyButton.Click += button5_Click;

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, oneButton, fiveButton, tenButton, thirtyButton, sixtyButton);
        }
예제 #2
0
        void Form1_Shown(object sender, System.EventArgs e)
        {
            listView1.SelectedIndexChanged += new System.EventHandler(listView1_SelectedIndexChanged);

            buttonFirst = new ThumbnailToolBarButton(Properties.Resources.first, "First Image");
            buttonFirst.Enabled = false;
            buttonFirst.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonFirst_Click);

            buttonPrevious = new ThumbnailToolBarButton(Properties.Resources.prevArrow, "Previous Image");
            buttonPrevious.Enabled = false;
            buttonPrevious.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonPrevious_Click);

            buttonNext = new ThumbnailToolBarButton(Properties.Resources.nextArrow, "Next Image");
            buttonNext.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonNext_Click);

            buttonLast = new ThumbnailToolBarButton(Properties.Resources.last, "Last Image");
            buttonLast.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonLast_Click);

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, buttonFirst, buttonPrevious, buttonNext, buttonLast);

            if (listView1.Items.Count > 0)
                listView1.Items[0].Selected = true;

            //
            TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip(this.Handle, new Rectangle(pictureBox1.Location, pictureBox1.Size));
        }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            prevTrackButton = new ThumbnailToolBarButton(Properties.Resources.PrevTrack, "Previous Track");
            prevTrackButton.Click += prevTrackButton_Click;

            nextTrackButton = new ThumbnailToolBarButton(Properties.Resources.NextTrack, "Next Track");
            nextTrackButton.Click += nextTrackButton_Click;

            playPauseButton = new ThumbnailToolBarButton(Properties.Resources.Play, "Play / Pause");
            playPauseButton.Click += playPauseButton_Click;

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, prevTrackButton, playPauseButton, nextTrackButton);
        }
        internal ThumbnailToolbarProxyWindow(System.Windows.UIElement windowsControl, ThumbnailToolBarButton[] buttons)
        {
            if (windowsControl == null) { throw new ArgumentNullException("windowsControl"); }
            if (buttons != null && buttons.Length == 0)
            {
                throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons");
            }

            _internalWindowHandle = IntPtr.Zero;
            WindowsControl = windowsControl;
            _thumbnailButtons = buttons;

            // Set the window handle on the buttons (for future updates)
            Array.ForEach(_thumbnailButtons, new Action<ThumbnailToolBarButton>(UpdateHandle));
        }
예제 #5
0
        public Form1()
        {
            InitializeComponent();

            // Listen for specific events on the tab control
            tabControl1.Selecting += new TabControlCancelEventHandler(tabControl1_Selecting);
            tabControl1.SelectedIndexChanged += new EventHandler(tabControl1_SelectedIndexChanged);

            // When the size of our form changes, invalidate the thumbnails so we can capture them again
            // when user requests a peek or thumbnail preview.
            this.SizeChanged += new EventHandler(Form1_SizeChanged);

            // Set our minimum size so the form will not have 0 height/width when user tries to resize it all the way
            this.MinimumSize = new Size(500, 100);

            // Show the Favorites window
            favsWindow = new FavoritesWindow(this);
            favsWindow.Show();

            // Create our Thumbnail toolbar buttons for the Browser doc
            thumbButtonBack = new ThumbnailToolBarButton(Properties.Resources.prevArrow, "Back");
            thumbButtonBack.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(thumbButtonBack_Click);

            thumbButtonForward = new ThumbnailToolBarButton(Properties.Resources.nextArrow, "Forward");
            thumbButtonForward.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(thumbButtonForward_Click);

            thumbButtonRefresh = new ThumbnailToolBarButton(Properties.Resources.refresh, "Refresh");
            thumbButtonRefresh.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(thumbButtonRefresh_Click);

            // Create our thumbnail toolbar buttons for the RichTextBox doc
            thumbButtonCut = new ThumbnailToolBarButton(Properties.Resources.cut, "Cut");
            thumbButtonCut.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(thumbButtonCut_Click);

            thumbButtonCopy = new ThumbnailToolBarButton(Properties.Resources.copy, "Copy");
            thumbButtonCopy.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(thumbButtonCopy_Click);

            thumbButtonPaste = new ThumbnailToolBarButton(Properties.Resources.paste, "Paste");
            thumbButtonPaste.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(thumbButtonPaste_Click);

            thumbButtonSelectAll = new ThumbnailToolBarButton(Properties.Resources.selectAll, "SelectAll");
            thumbButtonSelectAll.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(thumbButtonSelectAll_Click);

            this.FormClosing += new FormClosingEventHandler(Form1_FormClosing);
        }
예제 #6
0
파일: Form1.cs 프로젝트: vestlirik/Player
        public Form1()
        {
            InitializeComponent();
            this.Text = "Стоп";
            auth = new Auth();
            player = new Player();
            this.Focus();
            lastInput = DateTime.Now;

            timer1.Stop();

            label7.Text = label8.Text = "";
            trackBar2.ValueChanged += trackBar2_ValueChanged;
            trackBar2.Value = player.Volume;
            //Attach the event handler of WMPengine
            player.StatusChanged += new Player.OnStatusUpdate(engine_StatusChanged);

            //tulbar
            buttonPlayPause = new ThumbnailToolBarButton
            (Properties.Resources.Hopstarter_Button_Button_Play, "Play");
            buttonPlayPause.Enabled = true;
            buttonPlayPause.Click +=
                new EventHandler<ThumbnailButtonClickedEventArgs>(button3_Click);

            buttonNext = new ThumbnailToolBarButton
            (Properties.Resources.Hopstarter_Button_Button_Fast_Forward, "Next");
            buttonNext.Enabled = true;
            buttonNext.Click +=
                 new EventHandler<ThumbnailButtonClickedEventArgs>(button4_Click);

            buttonPrevious = new ThumbnailToolBarButton(Properties.Resources.Custom_Icon_Design_Pretty_Office_8_Fast_backward, "Previous");
            buttonPrevious.Click +=
              new EventHandler<ThumbnailButtonClickedEventArgs>(button2_Click);

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons
               (this.Handle, buttonPrevious, buttonPlayPause, buttonNext);
            TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip
              (this.Handle, new Rectangle(albumart.Location, albumart.Size));


            notifyIcon1.Visible = true;
            notifyIcon1.Icon = SystemIcons.Hand;
        }
        internal ThumbnailToolbarProxyWindow(IntPtr windowHandle, ThumbnailToolBarButton[] buttons)
        {
            if (windowHandle == IntPtr.Zero)
            {
                throw new ArgumentException(LocalizedMessages.CommonFileDialogInvalidHandle, "windowHandle");
            }
            if (buttons != null && buttons.Length == 0)
            {
                throw new ArgumentException(LocalizedMessages.ThumbnailToolbarManagerNullEmptyArray, "buttons");
            }

            _internalWindowHandle = windowHandle;
            _thumbnailButtons = buttons;

            // Set the window handle on the buttons (for future updates)
            Array.ForEach(_thumbnailButtons, new Action<ThumbnailToolBarButton>(UpdateHandle));

            // Assign the window handle (coming from the user) to this native window
            // so we can intercept the window messages sent from the taskbar to this window.
            this.AssignHandle(windowHandle);
        }
        internal void ZScreen_Windows7onlyTasks()
        {
            if (!Engine.ConfigApp.Windows7TaskbarIntegration)
            {
                if (Engine.zJumpList != null)
                {
                    Engine.zJumpList.ClearAllUserTasks();
                    Engine.zJumpList.Refresh();
                }
            }
            else if (!IsDisposed && !_Windows7TaskbarIntegrated && Engine.ConfigApp.Windows7TaskbarIntegration && this.Handle != IntPtr.Zero && TaskbarManager.IsPlatformSupported && this.ShowInTaskbar)
            {
                try
                {
                    Engine.CheckFileRegistration();

                    Engine.zWindowsTaskbar = TaskbarManager.Instance;
                    Engine.zWindowsTaskbar.ApplicationId = Engine.appId;

                    Engine.zJumpList = JumpList.CreateJumpList();

                    // User Tasks
                    JumpListLink jlCropShot = new JumpListLink(Adapter.ZScreenCliPath(), "Crop Shot");
                    jlCropShot.Arguments = "-cc";
                    jlCropShot.IconReference = new IconReference(Adapter.ResourcePath, 1);
                    Engine.zJumpList.AddUserTasks(jlCropShot);

                    JumpListLink jlSelectedWindow = new JumpListLink(Adapter.ZScreenCliPath(), "Selected Window");
                    jlSelectedWindow.Arguments = "-sw";
                    jlSelectedWindow.IconReference = new IconReference(Adapter.ResourcePath, 2);
                    Engine.zJumpList.AddUserTasks(jlSelectedWindow);

                    JumpListLink jlClipboardUpload = new JumpListLink(Adapter.ZScreenCliPath(), "Clipboard Upload");
                    jlClipboardUpload.Arguments = "-cu";
                    jlClipboardUpload.IconReference = new IconReference(Adapter.ResourcePath, 3);
                    Engine.zJumpList.AddUserTasks(jlClipboardUpload);

                    JumpListLink jlHistory = new JumpListLink(Application.ExecutablePath, "Open History");
                    jlHistory.Arguments = "-hi";
                    jlHistory.IconReference = new IconReference(Adapter.ResourcePath, 4);
                    Engine.zJumpList.AddUserTasks(jlHistory);

                    // Recent Items
                    Engine.zJumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;

                    // Custom Categories
                    JumpListCustomCategory paths = new JumpListCustomCategory("Paths");

                    JumpListLink imagesJumpListLink = new JumpListLink(FileSystem.GetImagesDir(), "Images");
                    imagesJumpListLink.IconReference = new IconReference(Path.Combine("%windir%", "explorer.exe"), 0);

                    JumpListLink settingsJumpListLink = new JumpListLink(Engine.SettingsDir, "Settings");
                    settingsJumpListLink.IconReference = new IconReference(Path.Combine("%windir%", "explorer.exe"), 0);

                    JumpListLink logsJumpListLink = new JumpListLink(Engine.LogsDir, "Logs");
                    logsJumpListLink.IconReference = new IconReference(Path.Combine("%windir%", "explorer.exe"), 0);

                    paths.AddJumpListItems(imagesJumpListLink, settingsJumpListLink, logsJumpListLink);
                    Engine.zJumpList.AddCustomCategories(paths);

                    // Taskbar Buttons
                    ThumbnailToolBarButton cropShot = new ThumbnailToolBarButton(Resources.shape_square_ico, "Crop Shot");
                    cropShot.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(cropShot_Click);

                    ThumbnailToolBarButton selWindow = new ThumbnailToolBarButton(Resources.application_double_ico, "Selected Window");
                    selWindow.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(selWindow_Click);

                    ThumbnailToolBarButton clipboardUpload = new ThumbnailToolBarButton(Resources.clipboard_upload_ico, "Clipboard Upload");
                    clipboardUpload.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(clipboardUpload_Click);

                    ThumbnailToolBarButton openHistory = new ThumbnailToolBarButton(Resources.pictures_ico, "History");
                    openHistory.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(OpenHistory);

                    if (!IsDisposed)
                    {
                        Engine.zWindowsTaskbar.ThumbnailToolBars.AddButtons(this.Handle, cropShot, selWindow, clipboardUpload, openHistory);
                        Engine.zJumpList.Refresh();
                    }
                    _Windows7TaskbarIntegrated = true;
                    DebugHelper.WriteLine("Integrated into Windows 7 Taskbar");
                }
                catch (Exception ex)
                {
                    DebugHelper.WriteException(ex, "Error while configuring Windows 7 Taskbar");
                }
            }

            DebugHelper.WriteLine(new StackFrame().GetMethod().Name);
        }
예제 #9
0
        private void CreateOrUpdateTaskBarButtons(bool validRepo)
        {
            #if !__MonoCS__
            if (Settings.RunningOnWindows && TaskbarManager.IsPlatformSupported)
            {
                if (!_toolbarButtonsCreated)
                {
                    _commitButton = new ThumbnailToolBarButton(IconGenerator.MakeIcon(toolStripButton1.Image, 48, true), toolStripButton1.Text);
                    _commitButton.Click += ToolStripButton1Click;

                    _pushButton = new ThumbnailToolBarButton(IconGenerator.MakeIcon(toolStripButtonPush.Image, 48, true), toolStripButtonPush.Text);
                    _pushButton.Click += PushToolStripMenuItemClick;

                    _pullButton = new ThumbnailToolBarButton(IconGenerator.MakeIcon(toolStripButtonPull.Image, 48, true), toolStripButtonPull.Text);
                    _pullButton.Click += PullToolStripMenuItemClick;

                    _toolbarButtonsCreated = true;
                    ThumbnailToolBarButton[] buttons = new[] { _commitButton, _pullButton, _pushButton };

                    //Call this method using reflection.  This is a workaround to *not* reference WPF libraries, becuase of how the WindowsAPICodePack was implimented.
                    TaskbarManager.Instance.ThumbnailToolBars.GetType().InvokeMember("AddButtons", System.Reflection.BindingFlags.InvokeMethod, null, TaskbarManager.Instance.ThumbnailToolBars,
                                                                                     new object[] { Handle, buttons });
                }

                _commitButton.Enabled = validRepo;
                _pushButton.Enabled = validRepo;
                _pullButton.Enabled = validRepo;
            }
            #endif
        }
        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            buttonFirst = new ThumbnailToolBarButton(Properties.Resources.first, "First Image");
            buttonFirst.Enabled = false;
            buttonFirst.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonFirst_Click);

            buttonPrevious = new ThumbnailToolBarButton(Properties.Resources.prevArrow, "Previous Image");
            buttonPrevious.Enabled = false;
            buttonPrevious.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonPrevious_Click);

            buttonNext = new ThumbnailToolBarButton(Properties.Resources.nextArrow, "Next Image");
            buttonNext.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonNext_Click);

            buttonLast = new ThumbnailToolBarButton(Properties.Resources.last, "Last Image");
            buttonLast.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(buttonLast_Click);

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(new WindowInteropHelper(this).Handle, buttonFirst, buttonPrevious, buttonNext, buttonLast);

            // Set our selection
            ImageList.SelectedIndex = 0;
            ImageList.Focus();

            if (ImageList.SelectedItem != null)
                ImageList.ScrollIntoView(ImageList.SelectedItem);
        }
 private void UpdateHandle(ThumbnailToolBarButton button)
 {
     button.WindowHandle   = _internalWindowHandle;
     button.AddedToTaskbar = false;
 }
예제 #12
0
        private void CreateThumbButtons()
        {
            _ButtonPrev = new ThumbnailToolBarButton(Utilities.ResourceHelper.GetIcon("Previous.ico"), Locale.Current.Tooltips.Previous);
            _ButtonPrev.Click += _ButtonPrev_Click;

            _ButtonInbox = new ThumbnailToolBarButton(Utilities.ResourceHelper.GetIcon("Inbox.ico"), Locale.Current.Tooltips.Inbox);
            _ButtonInbox.Click += _ButtonInbox_Click;

            _ButtonNext = new ThumbnailToolBarButton(Utilities.ResourceHelper.GetIcon("Next.ico"), Locale.Current.Tooltips.Next);
            _ButtonNext.Click += _ButtonNext_Click;
            //_ButtonNext.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(this._ButtonNext_Click);

            //_ButtonNext.Click += delegate(object sender, ThumbnailButtonClickedEventArgs e) {
            //  MessageBox.Show("Clicked");
            //};

            _TaskbarManager.ThumbnailToolBars.AddButtons(base.Handle, new ThumbnailToolBarButton[] { _ButtonPrev, _ButtonInbox, _ButtonNext });
        }
예제 #13
0
        private void SetThumbnailToolbars()
        {
            playToolButton = new ThumbnailToolBarButton(Properties.Resources.tool_play, "Play") { Enabled = false };
            playToolButton.Click += playToolButton_Click;

            nextToolButton = new ThumbnailToolBarButton(Properties.Resources.tool_next, "Next file") { Enabled = false };
            nextToolButton.Click += nextToolButton_Click;

            previousToolButton = new ThumbnailToolBarButton(Properties.Resources.tool_previous, "Previous file") { Enabled = false };
            previousToolButton.Click += previousToolButton_Click;
            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, previousToolButton, playToolButton, nextToolButton);
        }
예제 #14
0
        private void CreateThumbButtons()
        {
            _ButtonPrev = new ThumbnailToolBarButton(Utilities.ResourceHelper.GetIcon("Previous.ico"), Locale.Current.Tooltips.Previous);
            _ButtonPrev.Click += _ButtonPrev_Click;

            _ButtonInbox = new ThumbnailToolBarButton(Utilities.ResourceHelper.GetIcon("Inbox.ico"), Locale.Current.Tooltips.Inbox);
            _ButtonInbox.Click += _ButtonInbox_Click;

            _ButtonNext = new ThumbnailToolBarButton(Utilities.ResourceHelper.GetIcon("Next.ico"), Locale.Current.Tooltips.Next);
            _ButtonNext.Click += _ButtonNext_Click;

            _taskbarManager.ThumbnailToolBars.AddButtons(base.Handle, new ThumbnailToolBarButton[] { _ButtonPrev, _ButtonInbox, _ButtonNext });
        }
 /// <summary>
 /// Creates a Event Args for the TabbedThumbnailButton.Click event
 /// </summary>
 /// <param name="windowsControl">WPF Control (UIElement) related to the event</param>
 /// <param name="button">Thumbnail toolbar button that was clicked</param>
 public ThumbnailButtonClickedEventArgs(UIElement windowsControl, ThumbnailToolBarButton button)
 {
     ThumbnailButton = button;
     WindowHandle = IntPtr.Zero;
     WindowsControl = windowsControl;
 }
예제 #16
0
        public MainWindow()
        {
            InitializeComponent();

            timerScrobble = new System.Windows.Forms.Timer();
            timerScrobble.Interval = 1000;
            timerScrobble.Tick += timerScrobble_Tick;

            timer = new System.Windows.Forms.Timer();
            timer.Interval = 800;
            timer.Tick += timer_Tick;

            player = new Player();
            this.Focus();
            lastInput = DateTime.Now;

            timer.Stop();
            timerScrobble.Stop();

            startTime.Content = startTime.Content = "0:00";
            progressBar.Value = 0;

            //Attach the event handler 
            player.StatusChanged += new Player.OnStatusUpdate(engine_StatusChanged);

            #region taskbar
            buttonPlayPause = new ThumbnailToolBarButton
                (Properties.Resources.Hopstarter_Button_Button_Play, "Play");
            buttonPlayPause.Enabled = true;
            buttonPlayPause.Click +=
                new EventHandler<ThumbnailButtonClickedEventArgs>(playPauseButton_Click1);

            buttonNext = new ThumbnailToolBarButton
            (Properties.Resources.Hopstarter_Button_Button_Fast_Forward, "Next");
            buttonNext.Enabled = true;
            buttonNext.Click +=
                 new EventHandler<ThumbnailButtonClickedEventArgs>(nextButton_Click1);

            buttonPrevious = new ThumbnailToolBarButton(Properties.Resources.Custom_Icon_Design_Pretty_Office_8_Fast_backward, "Previous");
            buttonPrevious.Click +=
              new EventHandler<ThumbnailButtonClickedEventArgs>(prevButton_Click1);

            #endregion


            //notifyIcon1.Visible = true;
            //notifyIcon1.Icon = SystemIcons.Hand;

            logInButton.Visibility = System.Windows.Visibility.Visible;
            logOutButton.Visibility = System.Windows.Visibility.Collapsed;
            usernameLabel.Visibility = System.Windows.Visibility.Collapsed;
            updateButton.Visibility = System.Windows.Visibility.Collapsed;
            offlineButton.Visibility = System.Windows.Visibility.Collapsed;

            sett = new Settings();
            ReadSettings();

            logInButton_Click(new object(), new RoutedEventArgs());
            if (sett.LastSessionKey != "")
                logInLastButton_Click(new object(), new RoutedEventArgs());

            volumeBar.Value = sett.VolumeLevel * 100;
            player.ChangeVolume(sett.VolumeLevel);

            checkBoxRepeat.IsChecked = sett.EnableRepeating;
            checkBoxShuffle.IsChecked = sett.EnableShuffling;
            playlistButton.IsChecked = sett.EnableViewPlaylist;
            BroadcastToVKButton.IsChecked = sett.EnableVKBroadcast;

            globalKeyThread = null;
        }
예제 #17
0
        /// <summary>
        /// Invoked when the window is loaded.
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event data</param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            U.L(LogLevel.Debug, "MAIN", "Loaded");

            // create thumbnail buttons
            taskbarPrev = new ThumbnailToolBarButton(Properties.Resources.Previous, U.T("TaskbarPrev"));
            taskbarPrev.Click += TaskbarPrevious_Clicked;
            taskbarPlay = new ThumbnailToolBarButton(Properties.Resources.Play, U.T("TaskbarPlay"));
            taskbarPlay.Click += TaskbarPlayPause_Clicked;
            taskbarNext = new ThumbnailToolBarButton(Properties.Resources.Next, U.T("TaskbarNext"));
            taskbarNext.Click += TaskbarNext_Clicked;
            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(
                new WindowInteropHelper(Application.Current.MainWindow).Handle, taskbarPrev, taskbarPlay, taskbarNext);

            // we have to remove controls from their parent so "LastChildFill" doesn't screw everything up
            // we add them later on when they are toggled
            MainContainer.Children.Remove(ControlPanel);
            ControlPanel.Visibility = Visibility.Visible;

            System.Windows.Forms.Application.EnableVisualStyles();

            WindowState = (WindowState)Enum.Parse(typeof(WindowState), SettingsManager.WinState);

            kListener.KeyDown += new RawKeyEventHandler(KListener_KeyDown);
            kListener.KeyUp += new RawKeyEventHandler(KListener_KeyUp);

            U.L(LogLevel.Debug, "MAIN", "Startup complete");

            ThreadStart GUIThread = delegate()
            {
                InitGUI();
            };
            Thread gui_thread = new Thread(GUIThread);
            gui_thread.Name = "Init GUI Thread";
            gui_thread.Priority = ThreadPriority.BelowNormal;
            gui_thread.Start();
        }
예제 #18
0
 /// <summary>
 /// Creates a Event Args for the TabbedThumbnailButton.Click event
 /// </summary>
 /// <param name="windowsControl">WPF Control (UIElement) related to the event</param>
 /// <param name="button">Thumbnail toolbar button that was clicked</param>
 public ThumbnailButtonClickedEventArgs(UIElement windowsControl, ThumbnailToolBarButton button)
 {
     ThumbnailButton = button;
     WindowHandle    = IntPtr.Zero;
     WindowsControl  = windowsControl;
 }
 private void UpdateHandle(ThumbnailToolBarButton button)
 {
     button.WindowHandle = _internalWindowHandle;
     button.AddedToTaskbar = false;
 }
예제 #20
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            _dataFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\stations.json";
            _categoryListFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\categories.json";
            _settingsFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\settings.json";
            _mpvPath = AppDomain.CurrentDomain.BaseDirectory + "\\mpv\\mpv.exe";

            _radioDb = new RadioDb(_dataFilePath, _categoryListFilePath);
            _settingReadWrite = new SettingReadWrite(_settingsFilePath, AppDomain.CurrentDomain.BaseDirectory + "\\eqsettings.json");

            _startInfo = PlayerProcess.StartInfo;

            _eqManager = new EqManager(PlayerProcess);

            #region taskbar buttons

            _playThumbnailToolBarButton = new ThumbnailToolBarButton(pausedIcon, "Play/Pause");
            _stopThumbnailToolBarButton = new ThumbnailToolBarButton(stopIcon, "Stop");
            _muteThumbnailToolBarButton = new ThumbnailToolBarButton(muteIcon, "Mute");
            _playThumbnailToolBarButton.Click += PlayThumbnailToolBarButtonOnClick;
            _stopThumbnailToolBarButton.Click += StopThumbnailToolBarButtonOnClick;
            _muteThumbnailToolBarButton.Click += MuteThumbnailToolBarButtonOnClick;
            _playThumbnailToolBarButton.Visible = true;
            _playThumbnailToolBarButton.Enabled = true;
            _stopThumbnailToolBarButton.Visible = true;
            _stopThumbnailToolBarButton.Enabled = true;
            _muteThumbnailToolBarButton.Visible = true;
            _muteThumbnailToolBarButton.Enabled = true;
            _playThumbnailToolBarButton.DismissOnClick = true;
            _stopThumbnailToolBarButton.DismissOnClick = true;

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, _playThumbnailToolBarButton,
                _stopThumbnailToolBarButton, _muteThumbnailToolBarButton);

            #endregion
        }
예제 #21
0
 /// <summary>
 /// Creates a Event Args for the TabbedThumbnailButton.Click event
 /// </summary>
 /// <param name="windowHandle">Window handle for the control/window related to the event</param>
 /// <param name="button">Thumbnail toolbar button that was clicked</param>
 public ThumbnailButtonClickedEventArgs(IntPtr windowHandle, ThumbnailToolBarButton button)
 {
     ThumbnailButton = button;
     WindowHandle    = windowHandle;
     WindowsControl  = null;
 }
예제 #22
0
        internal void SetupThumbAndButtons()
        {
            _thumbForm = new ThumbForm(this);

            _thumb = new TabbedThumbnail(this.Handle, _thumbForm);
            _thumb.Title = _gmailClient.Username;
            _thumb.SetWindowIcon((Icon)this.Icon.Clone());

            _thumb.TabbedThumbnailClosed += (sender, e) =>
            {
                //ideally what i would like to here is cancel the close event
                //unfortunately it appears there is a bug in the WindowsAPICodePack which is not receiving any attention from Microsoft
                //the next best alternative is just to close the entire application, otherwise it will crash next time we try to update the thumbnail preview
                Close();

            };

            _thumbForm.Show();
            _thumbForm.Render();

            _prevButton = new ThumbnailToolBarButton(Properties.Resources.Previous, "Previous") { Enabled = false };
            _openButton = new ThumbnailToolBarButton(Properties.Resources.Open, "Open") { Enabled = false };
            _nextButton = new ThumbnailToolBarButton(Properties.Resources.Next, "Next") { Enabled = false };

            _prevButton.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(PrevButtonClicked);
            _openButton.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(OpenButtonClicked);
            _nextButton.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(NextButtonClicked);

            TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(_thumb);

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(_thumbForm.Handle, _prevButton, _openButton, _nextButton);
        }
예제 #23
0
        internal void SetupThumbAndButtons()
        {
            _thumbForm = new ThumbForm(this);

            _thumb = new TabbedThumbnail(this.Handle, _thumbForm);
            _thumb.Title = _gmailClient.Username;
            _thumb.SetWindowIcon((Icon)this.Icon.Clone());

            _thumbForm.Show();
            _thumbForm.Render();

            _prevButton = new ThumbnailToolBarButton(Properties.Resources.Previous, "Previous") { Enabled = false };
            _openButton = new ThumbnailToolBarButton(Properties.Resources.Open, "Open") { Enabled = false };
            _nextButton = new ThumbnailToolBarButton(Properties.Resources.Next, "Next") { Enabled = false };

            _prevButton.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(PrevButtonClicked);
            _openButton.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(OpenButtonClicked);
            _nextButton.Click += new EventHandler<ThumbnailButtonClickedEventArgs>(NextButtonClicked);

            TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(_thumb);

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(_thumbForm.Handle, _prevButton, _openButton, _nextButton);
        }
예제 #24
0
        /// <summary>
        /// Initialise les différents éléments de la barre des tâches (Windows 7 ou supérieur)
        /// </summary>
        private void InitializeTaskBar()
        {
            if (TaskbarManager.IsPlatformSupported)
                try
                {
                    _toolbarbutgo = new ThumbnailToolBarButton(new Icon("go.ico"), ButGo.Text);
                    _toolbarbutgo.Click += ButGo_Click;

                    ThumbnailToolBarButton butquit = new ThumbnailToolBarButton(new Icon("quit.ico"), "Quitter l'application");
                    butquit.Click += quitterToolStripMenuItem_Click;

                    TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, _toolbarbutgo, butquit);

                    SetTaskBarHistory();

                    //int size = ClistToCopy.Items.Count < 10 ? ClistToCopy.Items.Count : 10;
                    //JumpList list = JumpList.CreateJumpList();
                    //JumpListCustomCategory cat = new JumpListCustomCategory("Disponible");
                    //JumpListCustomCategory[] cats = new JumpListCustomCategory[1];
                    //cats[0] = cat;
                    //IJumpListItem[] listitem = new IJumpListItem[size];
                    //for (int i = 0; i < size; i++)
                    //    try
                    //    {
                    //        listitem[i] = new JumpListItem((ClistToCopy.Items[i] as Episode).FilePath);
                    //    }
                    //    catch { }
                    //cat.AddJumpListItems(listitem);
                    //list.AddCustomCategories(cats);
                    //list.Refresh();
                }
                catch (Exception ex)
                {
                    WriteLog(ex);
                }
        }
예제 #25
0
        private void CreateToolBarButtons()
        {
            var buttons = new List<ThumbnailToolBarButton>();

            s_PlayPauseButton = new ThumbnailToolBarButton(s_PlayIcon, TEXT_PLAY);
            s_PlayPauseButton.Click += PlayPauseClick;

            s_StopButton = new ThumbnailToolBarButton(s_StopIcon, TEXT_STOP);
            s_StopButton.Click += StopClick;

            s_ForwardButton = new ThumbnailToolBarButton(s_ForwardIcon, TEXT_FORWARD);
            s_ForwardButton.Click += ForwardClick;

            s_BackwardButton = new ThumbnailToolBarButton(s_BackwardIcon, TEXT_BACKWARD);
            s_BackwardButton.Click += BackwardClick;

            buttons.Add(s_BackwardButton);
            buttons.Add(s_PlayPauseButton);
            buttons.Add(s_StopButton);
            buttons.Add(s_ForwardButton);

            if (m_Playlist != null)
            {
                s_NextButton = new ThumbnailToolBarButton(s_NextIcon, TEXT_NEXT);
                s_NextButton.Click += NextClick;

                s_PrevButton = new ThumbnailToolBarButton(s_PrevIcon, TEXT_PREV);
                s_PrevButton.Click += PrevClick;

                buttons.Add(s_NextButton);
                buttons.Insert(0, s_PrevButton);
            }

            Taskbar.ThumbnailToolBars.AddButtons(m_MpdnFormHandle, buttons.ToArray());
        }
 /// <summary>
 /// Creates a Event Args for the TabbedThumbnailButton.Click event
 /// </summary>
 /// <param name="windowHandle">Window handle for the control/window related to the event</param>
 /// <param name="button">Thumbnail toolbar button that was clicked</param>
 public ThumbnailButtonClickedEventArgs(IntPtr windowHandle, ThumbnailToolBarButton button)
 {
     ThumbnailButton = button;
     WindowHandle = windowHandle;
     //WindowsControl = null;
 }
예제 #27
0
        private void CreateOrUpdateTaskBarButtons(bool validRepo)
        {
            #if !__MonoCS__
            if (EnvUtils.RunningOnWindows() && TaskbarManager.IsPlatformSupported)
            {
                if (!_toolbarButtonsCreated)
                {
                    _commitButton = new ThumbnailToolBarButton(MakeIcon(toolStripButton1.Image, 48, true), toolStripButton1.Text);
                    _commitButton.Click += ToolStripButton1Click;

                    _pushButton = new ThumbnailToolBarButton(MakeIcon(toolStripButtonPush.Image, 48, true), toolStripButtonPush.Text);
                    _pushButton.Click += PushToolStripMenuItemClick;

                    _pullButton = new ThumbnailToolBarButton(MakeIcon(toolStripButtonPull.Image, 48, true), toolStripButtonPull.Text);
                    _pullButton.Click += PullToolStripMenuItemClick;

                    _toolbarButtonsCreated = true;
                    ThumbnailToolBarButton[] buttons = new[] { _commitButton, _pullButton, _pushButton };

                    //Call this method using reflection.  This is a workaround to *not* reference WPF libraries, becuase of how the WindowsAPICodePack was implimented.
                    TaskbarManager.Instance.ThumbnailToolBars.AddButtons(Handle, buttons);
                }

                _commitButton.Enabled = validRepo;
                _pushButton.Enabled = validRepo;
                _pullButton.Enabled = validRepo;
            }
            #endif
        }
예제 #28
0
        // Function to create thumbnail buttons
        private void CreateThumbnailButtons()
        {
            Bitmap bmp;
            Icon icon;

            bmp = new Bitmap(btnPlay.Image);
            bmp.SetResolution(16,16);
            icon = System.Drawing.Icon.FromHandle(bmp.GetHicon());
            play = new ThumbnailToolBarButton(icon, "Play,Pause");
            play.Click += (s, e) => btnPlay_Click(s,e);

            bmp = new Bitmap(btnPrev.Image);
            bmp.SetResolution(16, 16);
            icon = System.Drawing.Icon.FromHandle(bmp.GetHicon());
            prev = new ThumbnailToolBarButton(icon, "Previous");
            prev.Click += (s, e) => btnPrev_Click(s, e);

            bmp = new Bitmap(btnNext.Image);
            bmp.SetResolution(16, 16);
            icon = System.Drawing.Icon.FromHandle(bmp.GetHicon());
            next = new ThumbnailToolBarButton(icon, "Next");
            next.Click += (s, e) => btnNext_Click(s, e);

            hide = new ThumbnailToolBarButton(Properties.Resources.hide, "Hide");
            hide.Click += (s, e) => HideMe();

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(this.Handle, prev,play,next,hide);
        }