Example #1
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            // Various checks to be performed when the main form is shown

            if (!Preferences.Current.IsLoaded)
            {
                // If IsLoaded is false, it means that this is the first time Tabular Editor is started (or that the Preferences.json file has been deleted)
                // In this case, let's ask the user if he wants to enable automatic updates.

                var res = MessageBox.Show("Do you want Tabular Editor to automatically check GitHub for updates on every startup?\n\nThis can be changed under File > Preferences.", "Enable automatic update check?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                Preferences.Current.CheckForUpdates = res == DialogResult.Yes;
                Preferences.Current.Save();
            }

            if (Preferences.Current.CheckForUpdates)
            {
                if (UpdateService.Check(false) ?? false)
                {
                    var res = MessageBox.Show("A new version of Tabular Editor is available. Would you like to open the download page now?\n\nYou can disable this check under File > Preferences.", "Tabular Editor update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (res == DialogResult.Yes)
                    {
                        UpdateService.OpenDownloadPage();
                    }
                }
            }
        }
Example #2
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            // Various checks to be performed when the main form is shown

            if (!Preferences.Current.IsLoaded)
            {
                // If IsLoaded is false, it means that this is the first time Tabular Editor is started (or that the Preferences.json file has been deleted)
                // In this case, let's ask the user if he wants to enable automatic updates.

                var res = MessageBox.Show("Do you want Tabular Editor to automatically check GitHub for updates on every startup?\n\nThis can be changed under File > Preferences.", "Enable automatic update check?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                Preferences.Current.CheckForUpdates = res == DialogResult.Yes;
                Preferences.Current.Save();
            }

            if (Preferences.Current.CheckForUpdates)
            {
                if (UpdateService.Check(false).UpdateAvailable(Preferences.Current.SkipPatchUpdates))
                {
                    var res = MessageBox.Show("A new version of Tabular Editor is available. Would you like to open the download page now?\n\nYou can disable this check under File > Preferences.", "Tabular Editor update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (res == DialogResult.Yes)
                    {
                        UpdateService.OpenDownloadPage();
                    }
                }
            }

            // Auto-load the file specified as command line arguments:
            var args        = Environment.GetCommandLineArgs();
            var modelSource = CommandLineHandler.GetModelSourceFromCLI(args, out _);

            if (modelSource == CommandLineHandler.ModelSource.File && (File.Exists(args[1]) || File.Exists(args[1] + "\\database.json")))
            {
                UI.File_Open(args[1]);
            }
            else if (modelSource == CommandLineHandler.ModelSource.ServerAndDatabase)
            {
                UI.Database_Open(args[1], args[2]);
            }
            else if (modelSource == CommandLineHandler.ModelSource.SingleLocalInstance)
            {
                var localInstances = PowerBIHelper.Instances;
                if (localInstances.Count == 1)
                {
                    UI.Database_Open($"localhost:{localInstances[0].Port}", "");
                }
            }
            else if (modelSource == CommandLineHandler.ModelSource.NamedLocalInstance)
            {
                var localInstance = PowerBIHelper.Instances.FirstOrDefault(i => i.Name.EqualsI(args[2]));
                if (localInstance != null)
                {
                    UI.Database_Open($"localhost:{localInstance.Port}", "");
                }
            }
        }
        private void btnVersionCheck_Click(object sender, EventArgs e)
        {
            var newVersion = UpdateService.Check(true);

            if (!newVersion.HasValue)
            {
                return;
            }
            if (newVersion.Value)
            {
                btnVersionCheck.Visible     = false;
                lblAvailableVersion.Visible = true;
                lblAvailableVersion.Text    = "Available Version: " + UpdateService.AvailableVersion + " (click to download)";
            }
            else
            {
                MessageBox.Show("You are currently using the latest version of Tabular Editor.", "No updates available", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #4
0
        private void FormMain_Shown(object sender, EventArgs e)
        {
            // Various checks to be performed when the main form is shown

            if (!Preferences.Current.IsLoaded)
            {
                // If IsLoaded is false, it means that this is the first time Tabular Editor is started (or that the Preferences.json file has been deleted)
                // In this case, let's ask the user if he wants to enable automatic updates.

                var res = MessageBox.Show("Do you want Tabular Editor to automatically check GitHub for updates on every startup?\n\nThis can be changed under File > Preferences.", "Enable automatic update check?", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                Preferences.Current.CheckForUpdates = res == DialogResult.Yes;
                Preferences.Current.Save();
            }

            if (Preferences.Current.CheckForUpdates)
            {
                if (UpdateService.Check(false).UpdateAvailable(Preferences.Current.SkipPatchUpdates))
                {
                    var res = MessageBox.Show("A new version of Tabular Editor is available. Would you like to open the download page now?\n\nYou can disable this check under File > Preferences.", "Tabular Editor update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (res == DialogResult.Yes)
                    {
                        UpdateService.OpenDownloadPage();
                    }
                }
            }

            // Auto-load the file specified as command line arguments:
            var args = Environment.GetCommandLineArgs();

            if (args.Length == 2 && (File.Exists(args[1]) || File.Exists(args[1] + "\\database.json")))
            {
                UI.File_Open(args[1]);
            }
            if (args.Length == 3)
            {
                UI.Database_Open(args[1], args[2]);
            }
        }
Example #5
0
        private void btnVersionCheck_Click(object sender, EventArgs e)
        {
            ProxyCache.ClearProxyCache();
            SaveProxySettings();
            var newVersion = UpdateService.Check(true);

            RestoreProxySettings();

            if (newVersion == VersionCheckResult.Unknown)
            {
                return;
            }
            if (newVersion == VersionCheckResult.NoNewVersion)
            {
                MessageBox.Show("You are currently using the latest version of Tabular Editor.", "No updates available", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                btnVersionCheck.Visible     = false;
                lblAvailableVersion.Visible = true;
                lblAvailableVersion.Text    = "Available Version: " + UpdateService.AvailableBuild + " (click to download)";
            }
        }