public UpdateCheckWindow(Procedure<String> downloadUpdate, UpdateCheck updateCheck)
        {
            InitializeComponent();

            this.downloadUpdate = downloadUpdate;

            if (updateCheck == null)
            {
                SetState(State.Checking);
                this.updateCheck = new UpdateCheck((IUpdateCheck)this);
            }
            else
            {
                this.updateCheck = updateCheck;
                SetState(State.Found);
            }
        }
Exemplo n.º 2
0
        private void Window_Activated(object sender, EventArgs e)
        {
            if (hasActivated)
            {
                return;
            }

            hasActivated = true;

            // start auto update thread
            if (Config.Settings.AutoUpdate)
            {
                updateCheck = new UpdateCheck((IUpdateCheck)this);
            }

            // check for a filename in the command line arguments (file association)
            String[] commandLineArgs = Environment.GetCommandLineArgs();

            if (commandLineArgs.Length > 1)
            {
                String fullPath = System.IO.Path.GetFullPath(commandLineArgs[1]);

                if (System.IO.File.Exists(fullPath))
                {
                    if (OpenDemo(fullPath))
                    {
                        return; // stop now, don't go to last folder/file
                    }
                }
            }

            // open last folder/file
            if (System.IO.Directory.Exists(Config.Settings.LastPath))
            {
                String lastFileName = Config.Settings.LastPath + "\\" + Config.Settings.LastFileName;

                if (System.IO.File.Exists(lastFileName))
                {
                    OpenDemo(lastFileName);
                }
                else
                {
                    CurrentPath = Config.Settings.LastPath;
                }
            }
            else
            {
                // default current path to desktop path
                CurrentPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            }
        }
Exemplo n.º 3
0
        private void Window_Activated(object sender, EventArgs e)
        {
            if (hasActivated)
            {
                return;
            }

            hasActivated = true;

            // if running for the first time, prompt the user to setup their Steam account details
            if (Program.FirstRun)
            {
                Common.Message(this, Config.ProgramName + " is running for the first time. Please ensure the detected Steam path and the selected Steam account folder are correct.");
                ShowPreferencesWindow(true);
            }

            // start auto update thread
            if (Config.Settings.AutoUpdate)
            {
                updateCheck = new UpdateCheck((IUpdateCheck)this);
            }

            // check for a file/server address in the command line arguments (file/protocol association)
            String[] commandLineArgs = Environment.GetCommandLineArgs();

            if (commandLineArgs.Length > 1)
            {
                if (commandLineArgs[1].StartsWith("hlsw://"))
                {
                    if (OpenServer(commandLineArgs[1]))
                    {
                        return; // stop now, don't go to last folder/file
                    }
                }
                else
                {
                    String fullPath = System.IO.Path.GetFullPath(commandLineArgs[1]);

                    if (System.IO.File.Exists(fullPath))
                    {
                        if (OpenDemo(fullPath))
                        {
                            return; // stop now, don't go to last folder/file
                        }
                    }
                }
            }

            // open last folder/file
            if (System.IO.Directory.Exists(Config.Settings.LastPath))
            {
                String lastFileName = Config.Settings.LastPath + "\\" + Config.Settings.LastFileName;

                if (System.IO.File.Exists(lastFileName))
                {
                    OpenDemo(lastFileName);
                }
                else
                {
                    uiExplorerTreeView.CurrentFolderPath = Config.Settings.LastPath;
                }
            }
        }