コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: WELL-E/Hurricane
        public MainWindow()
        {
            InitializeComponent();
            HostedWindow = null;
            MagicArrow = new MagicArrow.MagicArrow();
            MagicArrow.MoveOut += (s, e) =>
            {
                HideEqualizer();
                HostedWindow.DisableWindow();
            };
            MagicArrow.MoveIn += (s, e) => { HostedWindow.EnableWindow(); };
            MagicArrow.FilesDropped +=
                (s, e) => { MainViewModel.Instance.DragDropFiles((string[]) e.Data.GetData(DataFormats.FileDrop)); };
            MagicArrow.Register(this);

            Closing += MainWindow_Closing;
            Loaded += MainWindow_Loaded;
            StateChanged += MainWindow_StateChanged;

            MagicArrow.DockManager.Docked += (s, e) => { ApplyHostWindow(SmartWindowSkin); };
            MagicArrow.DockManager.Undocked += (s, e) => { ApplyHostWindow(AdvancedWindowSkin); };
            MagicArrow.DockManager.DragStopped += DockManagerOnDragStopped;
            SourceInitialized += MainWindow_SourceInitialized;

            var appsettings = HurricaneSettings.Instance.CurrentState;
            if (appsettings.ApplicationState == null)
            {
                WindowStartupLocation = WindowStartupLocation.CenterScreen;
                appsettings.ApplicationState = new DockingApplicationState
                {
                    CurrentSide = DockingSide.None,
                    Height = 600,
                    Width = 1000,
                    Left = Left,
                    Top = Top
                };
            }

            if (appsettings.ApplicationState.CurrentSide == DockingSide.None)
            {
                if (appsettings.ApplicationState.Left < WpfScreen.MostRightX)
                    //To prevent that the window is out of view when the user unplugs a monitor
                {
                    Height = appsettings.ApplicationState.Height;
                    Width = appsettings.ApplicationState.Width;
                    Left = appsettings.ApplicationState.Left;
                    Top = appsettings.ApplicationState.Top;
                    WindowState = appsettings.ApplicationState.WindowState;
                }
                else
                {
                    WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
            }

            MagicArrow.DockManager.CurrentSide = appsettings.ApplicationState.CurrentSide;
            WindowDialogService = new WindowDialogService(this);
            SystemEvents.PowerModeChanged += SystemEventsOnPowerModeChanged;
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: Zhenya1256/XTest
        public MainWindow()
        {
            InitializeComponent();
            HostedWindow        = null;
            MagicArrow          = new MagicArrow.MagicArrow();
            MagicArrow.MoveOut += (s, e) =>
            {
                HideEqualizer();
                HostedWindow.DisableWindow();
            };
            MagicArrow.MoveIn       += (s, e) => { HostedWindow.EnableWindow(); };
            MagicArrow.FilesDropped +=
                (s, e) => { MainViewModel.Instance.DragDropFiles((string[])e.Data.GetData(DataFormats.FileDrop)); };
            MagicArrow.Register(this);

            Closing      += MainWindow_Closing;
            Loaded       += MainWindow_Loaded;
            StateChanged += MainWindow_StateChanged;

            MagicArrow.DockManager.Docked      += (s, e) => { ApplyHostWindow(SmartWindowSkin); };
            MagicArrow.DockManager.Undocked    += (s, e) => { ApplyHostWindow(AdvancedWindowSkin); };
            MagicArrow.DockManager.DragStopped += DockManagerOnDragStopped;

            var appsettings = HurricaneSettings.Instance.CurrentState;

            if (appsettings.ApplicationState == null)
            {
                WindowStartupLocation        = WindowStartupLocation.CenterScreen;
                appsettings.ApplicationState = new DockingApplicationState
                {
                    CurrentSide = DockingSide.None,
                    Height      = 600,
                    Width       = 1000,
                    Left        = Left,
                    Top         = Top
                };
            }

            if (appsettings.ApplicationState.CurrentSide == DockingSide.None)
            {
                if (appsettings.ApplicationState.Left < WpfScreen.MostRightX)
                //To prevent that the window is out of view when the user unplugs a monitor
                {
                    Height      = appsettings.ApplicationState.Height;
                    Width       = appsettings.ApplicationState.Width;
                    Left        = appsettings.ApplicationState.Left;
                    Top         = appsettings.ApplicationState.Top;
                    WindowState = appsettings.ApplicationState.WindowState;
                }
                else
                {
                    WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }
            }

            MagicArrow.DockManager.CurrentSide = appsettings.ApplicationState.CurrentSide;
            WindowDialogService            = new WindowDialogService(this);
            SystemEvents.PowerModeChanged += SystemEventsOnPowerModeChanged;
        }