private void InitFlowDocument()
        {
            //make hyperlinks work
            var hyperlinks = WPFElementHelper.GetVisuals(AboutFlowDocument).OfType <Hyperlink>();

            foreach (var link in hyperlinks)
            {
                link.RequestNavigate += new System.Windows.Navigation.RequestNavigateEventHandler((sender, args) =>
                {
                    Process.Start(new ProcessStartInfo(args.Uri.AbsoluteUri));
                    args.Handled = true;
                });
            }
        }
Esempio n. 2
0
        public MainWindow()
        {
            SetupLogging();
            InitializeComponent();

            var assembly = Assembly.GetExecutingAssembly();
            var fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            var version  = fvi.FileVersion;

            intro.Content = intro.Content + " v" + version;

            //allows click and drag anywhere on the window
            containerPanel.MouseLeftButtonDown += GridPanel_MouseLeftButtonDown;

            var srPathStr = ReadPath("SRSPath");

            if (srPathStr != "")
            {
                srPath.Text = srPathStr;
            }

            var scriptsPath = ReadPath("IL2Path");

            if (scriptsPath != "")
            {
                IL2ScriptsPath.Text = scriptsPath;
            }
            else
            {
                IL2ScriptsPath.Text = "";
            }

            //To get the location the assembly normally resides on disk or the install directory
            var currentPath = GetWorkingDirectory();

            if (currentPath.StartsWith("file:\\"))
            {
                currentPath = currentPath.Replace("file:\\", "");
            }

            _currentDirectory = currentPath;

            Logger.Info("Listing Files / Directories for: " + _currentDirectory);
            ListFiles(_currentDirectory);
            Logger.Info("Finished Listing Files / Directories");

            if (!CheckExtracted())
            {
                MessageBox.Show(
                    "Please extract the entire installation zip into a folder and then run the installer from the extracted folder.\n\nDo not run the installer from the zip as it wont work!",
                    "Please Extract Installation zip",
                    MessageBoxButton.OK, MessageBoxImage.Error);

                Logger.Warn("IL2 is Running - Installer quit");

                Environment.Exit(0);

                return;
            }

            var hyperlinks = WPFElementHelper.GetVisuals(HelpText).OfType <Hyperlink>();

            foreach (var link in hyperlinks)
            {
                link.RequestNavigate += new System.Windows.Navigation.RequestNavigateEventHandler((sender, args) =>
                {
                    Process.Start(new ProcessStartInfo(args.Uri.AbsoluteUri));
                    args.Handled = true;
                });
            }
        }