예제 #1
0
        public MainWindow()
        {
            InitializeComponent();
            launchPage                 = new LaunchGamePage(logic);
            serverPage                 = new ServerPage(logic);
            optionPage                 = new OptionPage(logic);
            serverConsolePage          = new ServerConsolePage(logic);
            logic.PirateDetectedEvent += PirateDetected;
            logic.StartServerEvent    += OnStartServer;
            logic.EndServerEvent      += OnEndServer;

            AppDomain.CurrentDomain.UnhandledException += CrashLog;

            imageDict = new Dictionary <Page, BitmapImage> {
                { launchPage, new BitmapImage(new Uri(@"/Images/PlayGameImage.png", UriKind.Relative)) },
                { serverPage, new BitmapImage(new Uri(@"/Images/EscapePod.png", UriKind.Relative)) },
                { serverConsolePage, new BitmapImage(new Uri(@"/Images/EscapePod.png", UriKind.Relative)) },
                { optionPage, new BitmapImage(new Uri(@"/Images/Vines.png", UriKind.Relative)) }
            };

            if (!File.Exists("path.txt"))
            {
                ChangeFrameContent(optionPage);
            }
            else
            {
                ChangeFrameContent(launchPage);
            }
        }
예제 #2
0
 public MainWindow()
 {
     InitializeComponent();
     launchPage = new LaunchGamePage(logic);
     serverPage = new ServerPage(logic);
     optionPage = new OptionPage(logic);
     logic.PirateDetectedEvent += PirateDetected;
     if (!File.Exists("path.txt"))
     {
         MainPage.Content = optionPage;
     }
     else
     {
         MainPage.Content = launchPage;
     }
 }
예제 #3
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            LauncherLogic     = new LauncherLogic();
            LaunchGamePage    = new LaunchGamePage();
            OptionPage        = new OptionPage();
            ServerConsolePage = new ServerConsolePage();
            ServerPage        = new ServerPage();
            MainWindow        = new MainWindow();
            MainWindow.Show();


            Log.Setup();

            // Error if running from a temporary directory because Nitrox Launcher won't be able to write files directly to zip/rar
            // Tools like WinRAR do this to support running EXE files while it's still zipped.
            if (Directory.GetCurrentDirectory().StartsWith(Path.GetTempPath(), StringComparison.OrdinalIgnoreCase))
            {
                MessageBox.Show("Nitrox launcher should not be executed from a temporary directory. Install Nitrox launcher properly by extracting ALL files and moving these to a dedicated location on your PC.",
                                "Invalid working directory",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                Environment.Exit(1);
            }
        }