예제 #1
0
        async void Update()
        {
            if (IsVisible && !openDialog && await MessageWindow.Create(
                    $"A new version of Apollo Studio is available ({(await Github.LatestRelease()).Name} - {(await Github.LatestDownload()).Size.Bytes().Humanize("#.##")}).\n\n" +
                    "Do you want to update to the latest version?",
                    new string[] { "Yes", "No" }, null
                    ) == "Yes")
            {
                foreach (Window window in App.Windows)
                {
                    if (window.GetType() != typeof(MessageWindow))
                    {
                        window.Close();
                    }
                }

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    Program.LaunchAdmin = true;
                }
                else
                {
                    UpdateWindow.Create(this);
                }
            }
        }
예제 #2
0
        public static void Create(Window owner)
        {
            UpdateWindow window = new UpdateWindow()
            {
                Owner = owner
            };

            window.Show();
            window.Owner = null;
        }
예제 #3
0
        void Update()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Program.LaunchAdmin = true;
            }
            else
            {
                UpdateWindow.Create(this);
            }

            foreach (Window window in App.Windows)
            {
                if (window.GetType() != typeof(MessageWindow) && window.GetType() != typeof(UpdateWindow))
                {
                    window.Close();
                }
            }
        }
예제 #4
0
        public static void Create(Window owner)
        {
            UpdateWindow window = new UpdateWindow();

            if (owner == null || owner.WindowState == WindowState.Minimized)
            {
                window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            }
            else
            {
                window.Owner = owner;
            }

            window.Show();
            window.Owner = null;

            window.Topmost = true;
            window.Topmost = Preferences.AlwaysOnTop;
        }
예제 #5
0
        async void Loaded(object sender, EventArgs e)
        {
            Position = new PixelPoint(Position.X, Math.Max(0, Position.Y));

            if (Launchpad.CFWIncompatible == CFWIncompatibleState.Show)
            {
                Launchpad.CFWError(this);
            }

            if (Program.Args?.Length > 0)
            {
                ReadFile(Program.Args[0]);
            }

            Program.Args = null;

            UpdateBlogpost();
            UpdateRelease();

            if (IsVisible && !openDialog && await Github.ShouldUpdate())
            {
                Window[] windows = Application.Current.Windows.ToArray();

                foreach (Window window in windows)
                {
                    if (window.GetType() != typeof(MessageWindow))
                    {
                        window.Close();
                    }
                }

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    Program.LaunchAdmin = true;
                }
                else
                {
                    UpdateWindow.Create(this);
                }
            }
        }