Exemplo n.º 1
0
        /// <summary>
        /// Show the tooltip without needing focus.
        /// </summary>
        /// <param name="name">Name of the tooltip</param>
        /// <param name="control">The parent control.</param>
        /// <param name="taskbarInfo">The taskbar information.</param>
        /// <param name="scaling">The scaling factor.</param>
        public void ShowWithoutRequireFocus(string name, MainControl control, TaskbarInfo taskbarInfo, double scaling)
        {
            if (!Active)
            {
                return;
            }

            int yOffset = 0;

            if (taskbarInfo.Edge == Edge.Top)
            {
                yOffset = control.Height + Margin;
            }
            else
            {
                yOffset = -Size.Height - Margin;
            }

            _scaling = scaling;
            const int TooltipTypeAbsolutePos = 2;
            var       controlScreenLocation  = control.PointToScreen(new Point(0, 0));
            var       popupLocation          = new Point(controlScreenLocation.X + (int)Math.Round(XPosition * scaling), controlScreenLocation.Y + (int)Math.Round(yOffset * scaling));

            _setToolMethod.Invoke(this, new object[] { control, name, TooltipTypeAbsolutePos, popupLocation });
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainControl"/> class.
        /// Entry point.
        /// </summary>
        /// <param name="options">The deskband options.</param>
        /// <param name="info">The taskbar info.</param>
        public MainControl(CSDeskBandOptions options, TaskbarInfo info)
        {
            InitializeComponent();

            _uiDispatcher = Dispatcher.CurrentDispatcher;
            Options       = options;
            TaskbarInfo   = info;
#pragma warning disable CS4014
            InitializeAsync();
#pragma warning restore CS4014
        }
Exemplo n.º 3
0
        public TimeFinder()
        {
            Options.IsFixed = false;

            TaskbarInfo.TaskbarSizeChanged += (sender, args) =>
            {
                mainControl.TaskbarWidth  = args.Size.Width;
                mainControl.TaskbarHeight = args.Size.Height;
            };

            mainControl.DisplayText = "Error";

            loadConfiguration();
            refreshDisplay_tick(null, null);

            DispatcherTimer dispatcherTimer = new DispatcherTimer();

            dispatcherTimer.Tick    += new EventHandler(refreshInfo_tick);
            dispatcherTimer.Interval = new TimeSpan(0, 30, 0);
            dispatcherTimer.Start();

            DispatcherTimer dispatcherTimer2 = new DispatcherTimer();

            dispatcherTimer2.Tick    += new EventHandler(refreshInfo2_tick);
            dispatcherTimer2.Interval = new TimeSpan(0, 30, 0);
            dispatcherTimer2.Start();

            DispatcherTimer dispatcherTimer3 = new DispatcherTimer();

            dispatcherTimer3.Tick    += new EventHandler(refreshDisplay_tick);
            dispatcherTimer3.Interval = new TimeSpan(0, 0, 5);
            dispatcherTimer3.Start();

            // For some reason, this needs to be manually called with a delay to get the Deskband
            // to match the taskbar height
            var timer = new DispatcherTimer {
                Interval = TimeSpan.FromSeconds(2)
            };

            timer.Start();
            timer.Tick += (sender, args) =>
            {
                TaskbarInfo.UpdateInfo();
                mainControl.TaskbarHeight = TaskbarInfo.Size.Height;
            };
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of <see cref="WinBandControl"/>.
        /// </summary>
        public WinBandControl()
        {
            try {
                Options.Title = BandCore.GetToolbarName(GetType());

                _impl = new BandCore(Handle, Options);
                _impl.VisibilityChanged += VisibilityChanged;
                _impl.Closed            += OnClose;

                TaskbarInfo  = _impl.TaskbarInfo;
                SizeChanged += CSDeskBandWin_SizeChanged;

                //Empty guid is a workaround for winforms designer because there will be no guid attribute
                _deskbandGuid = new Guid(GetType().GetCustomAttribute <GuidAttribute>(true)?.Value ?? Guid.Empty.ToString("B"));
            }
            catch {
                throw;
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Show the tooltip without needing focus.
        /// </summary>
        /// <param name="name">Name of the tooltip</param>
        /// <param name="control">The parent control.</param>
        /// <param name="taskbarInfo">The taskbar information.</param>
        public void ShowWithoutRequireFocus(string name, MainControl control, TaskbarInfo taskbarInfo)
        {
            if (!Active)
            {
                return;
            }

            int yOffset = 0;

            if (taskbarInfo.Edge == Edge.Top)
            {
                yOffset = control.Height + Margin;
            }
            else
            {
                yOffset = -Size.Height - Margin;
            }

            const int AbsolutePos           = 2;
            var       controlScreenLocation = control.PointToScreen(new Point(0, 0));

            _setToolMethod.Invoke(this, new object[] { control, name, AbsolutePos, new Point(controlScreenLocation.X + XPosition, controlScreenLocation.Y + yOffset) });
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainControl"/> class.
        /// Entry point.
        /// </summary>
        /// <param name="options">The deskband options.</param>
        /// <param name="info">The taskbar info.</param>
        /// <param name="track">The track model.</param>
        /// <param name="appsettings">The app settings</param>
        /// <param name="audiosourceMananger">The audio source manager</param>
        /// <param name="settingsWindow">The settings window.</param>
        /// <param name="labelService">The label service.</param>
        public MainControl(
            CSDeskBandOptions options,
            TaskbarInfo info,
            Track track,
            IAppSettings appsettings,
            IAudioSourceManager audiosourceMananger,
            ISettingsWindow settingsWindow,
            ICustomLabelService labelService)
        {
            InitializeComponent();

            _uiDispatcher       = Dispatcher.CurrentDispatcher;
            Options             = options;
            TaskbarInfo         = info;
            _appSettings        = appsettings;
            _audioSourceManager = audiosourceMananger;
            _track          = track;
            _settingsWindow = settingsWindow;
            _labelService   = labelService;

#pragma warning disable CS4014
            Task.Run(InitializeAsync);
#pragma warning restore CS4014
        }