Exemplo n.º 1
0
        public SidePanelContainer(MainForm mainForm)
        {
            InitializeComponent();

            _parent = mainForm;
            RequestClosingHandler = new EventHandler(Panel_RequestClosing);
        }
Exemplo n.º 2
0
        public WindowListMenuManager(MainForm owner, ContextMenuStrip windowsMenu)
        {
            _owner = owner;
            _windowsMenu = windowsMenu;

            WindowSeeker = new TaskWindowSeeker() {
                OwnerHandle = owner.Handle,
                SkipNotVisibleWindows = true
            };

            //Bind events
            windowsMenu.Opening += new System.ComponentModel.CancelEventHandler(WindowsMenu_opening);
        }
Exemplo n.º 3
0
 public NotificationIcon(MainForm form)
 {
     Form = form;
     Install();
 }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            //Hook fatal abort handler
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Initialize and check for platform support
            Platform = PlatformSupport.Create();
            if (!Platform.CheckCompatibility())
                return;
            Platform.PreHandleFormInit();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Update settings if needed
            /*if (Settings.Default.MustUpdate)
            {
                Settings.Default.Upgrade();
                Settings.Default.MustUpdate = false;
            }*/

            //Load startup options

            var options = StartupOptions.Factory.CreateOptions(args);
            string optionsMessage = options.DebugMessage;
            if (!string.IsNullOrEmpty(optionsMessage))
            { //show dialog if debug message present or if parsing failed
                var dlg = new CommandLineReportForm(options.Status, optionsMessage);
                dlg.ShowDialog();
            }
            if (options.Status == CliStatus.Information || options.Status == CliStatus.Error)
                return;

            //Load language
            //Thread.CurrentThread.CurrentUICulture = Settings.Default.Language;

            //Show form
            using (_mainForm = new MainForm(options))
            {
                Alpha oAlpha = new Alpha();
                Thread oThread = new Thread(new ThreadStart(oAlpha.Beta));
                oThread.Start();

                //Enter GUI loop
                Application.Run(_mainForm);

                //Persist settings
                Settings.Default.RestoreLastPosition = _mainForm.Location;
                Settings.Default.RestoreLastSize = _mainForm.ClientSize;
                Settings.Default.Save();
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Restores the main form to its default state after is has been hidden.
 /// Can be called whether the form is hidden or not.
 /// </summary>
 /// <param name="form">Form to restore.</param>
 public virtual void RestoreForm(MainForm form)
 {
 }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a form after its handle has been created.
 /// </summary>
 /// <param name="form">Form to initialize.</param>
 public virtual void PostHandleFormInit(MainForm form)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Called when the form changes its state, without calling into <see cref="RestoreForm"/> or <see cref="HideForm"/>.
 /// Enables inheritors to update the form's state on each state change.
 /// </summary>
 public virtual void OnFormStateChange(MainForm form)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Gets whether the form is currently hidden or not.
 /// </summary>
 public virtual bool IsHidden(MainForm form)
 {
     return false;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Hides the main form in a way that it can be restored later by the user.
 /// </summary>
 /// <param name="form">Form to hide.</param>
 public virtual void HideForm(MainForm form)
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Called before closing a form. Called once during a form's lifetime.
 /// </summary>
 public virtual void CloseForm(MainForm form)
 {
 }
Exemplo n.º 11
0
 /// <summary>
 /// Is called when the side panel is embedded and first shown.
 /// </summary>
 /// <param name="form">Parent form that is embedding the side panel.</param>
 public virtual void OnFirstShown(MainForm form)
 {
     ParentForm = form;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Is called before removing the side panel.
 /// </summary>
 /// <param name="form">Parent form that is embedding the side panel.</param>
 public virtual void OnClosing(MainForm form)
 {
 }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            //Hook fatal abort handler
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Initialize and check for platform support
            Platform = PlatformSupport.Create();
            if (!Platform.CheckCompatibility())
                return;
            Platform.PreHandleFormInit();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Update settings if needed
            if (Settings.Default.MustUpdate) {
                Settings.Default.Upgrade();
                Settings.Default.MustUpdate = false;
            }

            //Load startup options
            var options = StartupOptions.Factory.CreateOptions(args);
            string optionsMessage = options.DebugMessage;
            if (!string.IsNullOrEmpty(optionsMessage)) { //show dialog if debug message present or if parsing failed
                var dlg = new CommandLineReportForm(options.Status, optionsMessage);
                dlg.ShowDialog();
            }
            if (options.Status == CliStatus.Information || options.Status == CliStatus.Error)
                return;

            //Load language
            Thread.CurrentThread.CurrentUICulture = Settings.Default.Language;

            //Show form
            using (_mainForm = new MainForm(options)) {
                //Start up update manager
                Update = new UpdateManager(_mainForm);
                Update.UpdateCheckCompleted += new EventHandler<UpdateCheckCompletedEventArgs>(UpdateManager_CheckCompleted);
                bool doneCheck = false;
                _mainForm.Shown += delegate {
                    if (doneCheck) return;
                    doneCheck = true;

                    //Delay first update check to when form is visible
                    Update.CheckForUpdate();
                };

                //Enter GUI loop
                Application.Run(_mainForm);

                //Persist settings
                Settings.Default.RestoreLastPosition = _mainForm.Location;
                Settings.Default.RestoreLastSize = _mainForm.ClientSize;
                Settings.Default.Save();
            }
        }
Exemplo n.º 14
0
 public FullscreenFormManager(MainForm form)
 {
     _mainForm = form;
     IsFullscreen = false;
 }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            //Hook fatal abort handler
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Initialize and check for platform support
            Platform = PlatformSupport.Create();
            if (!Platform.CheckCompatibility())
                return;
            Platform.PreHandleFormInit();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Update settings if needed
            if (Settings.Default.MustUpdate) {
                Settings.Default.Upgrade();
                Settings.Default.MustUpdate = false;
            }

            //Load startup options
            var options = StartupOptions.Factory.CreateOptions(args);
            string optionsMessage = options.DebugMessage;
            if (!string.IsNullOrEmpty(optionsMessage)) { //show dialog if debug message present or if parsing failed
                var dlg = new CommandLineReportForm(options.Status, optionsMessage);
                dlg.ShowDialog();
            }
            if (options.Status == CliStatus.Information || options.Status == CliStatus.Error)
                return;

            //Load language
            Thread.CurrentThread.CurrentUICulture = Settings.Default.Language;

            //Show form
            using (_mainForm = new MainForm(options)) {
                Application.Idle += _handlerIdleUpdater;

                //Enter GUI loop
                Application.Run(_mainForm);

                //HACK: re-enable chrome to fix position persistence (ideally, chrome status should be stored and restored - but this is not always possible)
                if (!_mainForm.IsChromeVisible)
                    _mainForm.IsChromeVisible = true;

                //Persist settings
                System.Diagnostics.Trace.WriteLine(string.Format("Persisting {0} size {1} to settings.", _mainForm.Location, _mainForm.ClientSize));
                Settings.Default.RestoreLastPosition = _mainForm.Location;
                Settings.Default.RestoreLastSize = _mainForm.ClientSize;
                Settings.Default.Save();
            }
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            try {
                AppPaths.SetupPaths();
            }
            catch (Exception ex) {
                MessageBox.Show(string.Format("Unable to setup application folders: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Log.Write("Launching OnTopReplica v.{0}", Application.ProductVersion);

            //Hook fatal abort handler
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            //Initialize and check for platform support
            Platform = PlatformSupport.Create();
            if (!Platform.CheckCompatibility())
                return;
            Platform.PreHandleFormInit();

            Log.Write("Platform support initialized");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Update settings if needed
            if (Settings.Default.MustUpdate) {
                Settings.Default.Upgrade();
                Settings.Default.MustUpdate = false;
            }

            //Load startup options
            var options = StartupOptions.Factory.CreateOptions(args);
            string optionsMessage = options.DebugMessage;
            if (!string.IsNullOrEmpty(optionsMessage)) { //show dialog if debug message present or if parsing failed
                var dlg = new CommandLineReportForm(options.Status, optionsMessage);
                dlg.ShowDialog();
            }
            if (options.Status == CliStatus.Information || options.Status == CliStatus.Error)
                return;

            //Load language
            Thread.CurrentThread.CurrentUICulture = Settings.Default.Language;

            //Show form
            using (_mainForm = new MainForm(options)) {
                Application.Idle += _handlerIdleUpdater;

                Log.Write("Entering application loop");

                //Enter GUI loop
                Application.Run(_mainForm);

                //Re-enable chrome to store correct position (position is stored always WITH chrome: when restoring fails, the position stays ok)
                Settings.Default.RestoreLastShowChrome = _mainForm.IsChromeVisible;
                if (!_mainForm.IsChromeVisible)
                    _mainForm.IsChromeVisible = true;

                //Persist settings
                Log.Write("Last position before shutdown: {0}, size: {1}", _mainForm.Location, _mainForm.Size);
                Settings.Default.RestoreLastPosition = _mainForm.Location;
                Settings.Default.RestoreLastSize = _mainForm.ClientSize;

                //Store last thumbnail, if any
                if (_mainForm.ThumbnailPanel.IsShowingThumbnail && _mainForm.CurrentThumbnailWindowHandle != null) {
                    Settings.Default.RestoreLastWindowTitle = _mainForm.CurrentThumbnailWindowHandle.Title;
                    Settings.Default.RestoreLastWindowHwnd = _mainForm.CurrentThumbnailWindowHandle.Handle.ToInt64();
                    Settings.Default.RestoreLastWindowClass = _mainForm.CurrentThumbnailWindowHandle.Class;
                }
                else {
                    Settings.Default.RestoreLastWindowTitle = string.Empty;
                    Settings.Default.RestoreLastWindowHwnd = 0;
                    Settings.Default.RestoreLastWindowClass = string.Empty;
                }

                Log.Write("Persisting settings");
                Settings.Default.Save();
            }

            Log.Write("Shutting down OnTopReplica");
        }