Esempio n. 1
0
        public void Teardown()
        {
            if( _mouseIndicatorWindow != null )
            {
                _mouseIndicatorWindow.Close();
                _editorWindow.Close();
            }

            if( _wpfStandardClickTypeWindow != null )
            {
                if( _wpfStandardClickTypeWindow.IsVisible ) _wpfStandardClickTypeWindow.Close();
            }

            _selector = null;
            _editorWindow = null;
            _mouseIndicatorWindow = null;
            _wpfStandardClickTypeWindow = null;
        }
Esempio n. 2
0
        public void Start()
        {
            if( HelpService.Status == InternalRunningStatus.Started ) HelpService.Service.RegisterHelpContent( PluginId, typeof( AutoClick ).Assembly.GetManifestResourceStream( "AutoClick.Res.helpcontent.zip" ) );

            _isPaused = true;
            _selector = new StdClickTypeSelector( this );
            _wpfStandardClickTypeWindow = new WPFStdClickTypeWindow() { DataContext = this };

            int defaultHeight = (int)( System.Windows.SystemParameters.WorkArea.Width ) / 4;
            int defaultWidth = defaultHeight / 4;

            if( !Config.User.Contains( "AutoClickWindowPlacement" ) )
            {
                SetDefaultWindowPosition( defaultWidth, defaultHeight );
            }
            else
            {
                _wpfStandardClickTypeWindow.Width = _wpfStandardClickTypeWindow.Height = 0;
            }

            _mouseIndicatorWindow = new MouseProgressPieWindow { DataContext = this };
            _editorWindow = new AutoClickEditorWindow { DataContext = this };

            Config.ConfigChanged += new EventHandler<ConfigChangedEventArgs>( OnConfigChanged );
            ConfigureMouseWatcher();
            RegisterEvents();

            Config.User.GetOrSet<bool>( "ShowMouseIndicatorOption", true );

            _mouseIndicatorWindow.Show();
            _wpfStandardClickTypeWindow.Show();

            //Executed only at first launch, has to be done once the window is shown, otherwise, it will save a "hidden" state for the window
            if( !Config.User.Contains( "AutoClickWindowPlacement" ) ) Config.User.Set( "AutoClickWindowPlacement", CKWindowTools.GetPlacement( _wpfStandardClickTypeWindow.Hwnd ) );
            CKWindowTools.SetPlacement( _wpfStandardClickTypeWindow.Hwnd, (WINDOWPLACEMENT)Config.User["AutoClickWindowPlacement"] );

            //Re-positions the window in the screen if it is not in it. Which may happen if the autoclick is saved as being on a secondary screen.
            if( !ScreenHelper.IsInScreen( new System.Drawing.Point( (int)_wpfStandardClickTypeWindow.Left, (int)_wpfStandardClickTypeWindow.Top ) )
                && !ScreenHelper.IsInScreen( new System.Drawing.Point( (int)( _wpfStandardClickTypeWindow.Left + _wpfStandardClickTypeWindow.ActualWidth ), (int)_wpfStandardClickTypeWindow.Top ) ) )
            {
                SetDefaultWindowPosition( defaultWidth, defaultHeight );
            }
            Pause( this );
        }