Connect() private method

private Connect ( ) : void
return void
Beispiel #1
0
        private void OnJoinVoiceMessage(JoinVoiceMessage msg)
        {
            MainForm main = new MainForm();

            main.Connect(msg.Target.Hostname, msg.Target.Port);
            main.Show();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            if (RaygunKey[0] != '{')
            {
                Raygun = new RaygunClient(RaygunKey);
            }

            AppDomain.CurrentDomain.UnhandledException += (sender, e) => {
                if (StartupLog != null)
                {
                    StartupLog.Error("Fatal Error", (Exception)e.ExceptionObject);
                }

                if (Raygun != null)
                {
                    Raygun.Send((Exception)e.ExceptionObject, null, Settings.CurrentSettings);
                }

                MessageBox.Show("Unexpected error" + Environment.NewLine + (e.ExceptionObject as Exception).ToDisplayString(),
                                "Unexpected error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            };

            //AutomaticErrorReporter errors = new AutomaticErrorReporter();
            //errors.Add (new GablarskiErrorReporter (typeof(Program).Assembly));

            log4net.Config.XmlConfigurator.Configure();
            StartupLog = LogManager.GetLogger("Startup");
            StartupLog.DebugFormat("PID: {0}", Process.GetCurrentProcess().Id);

            FileInfo program = new FileInfo(Process.GetCurrentProcess().MainModule.FileName);

            Environment.CurrentDirectory = program.Directory.FullName;

            string useLocalValue = ConfigurationManager.AppSettings["useLocalDatabase"];
            bool   useLocal;

            Boolean.TryParse(useLocalValue, out useLocal);

            StartupLog.DebugFormat("Local files: {0}", useLocal);
            StartupLog.DebugFormat("Setting up databases..");

            ClientData.Setup(useLocal);

            StartupLog.DebugFormat("Databases setup.");

            CheckForUpdates();

            StartupLog.Debug("Starting key retrieval");
            var keyCancelSource = new CancellationTokenSource();

            Key = ClientData.GetCryptoKeyAsync(keyCancelSource.Token);
            Key.ContinueWith(t => StartupLog.DebugFormat("Key retrieval: {0}{1}{2}", t.Status, Environment.NewLine, t.Exception));

            SetupFirstRun();

            if (Settings.Nickname == null)
            {
                PersonalSetup();
            }

            if (!ShowKeyProgress(keyCancelSource))
            {
                return;
            }

            ResourceWebRequestFactory.Register();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //SetupSocial();

            /*MainWindow window = new MainWindow();
             * window.Show();*/

            var m = new MainForm();

            m.Show();

            UpdateTaskbarServers();

            if (args.Length > 0)
            {
                int id;
                if (Int32.TryParse(args[0], out id))
                {
                    ServerEntry server = Servers.GetEntries().FirstOrDefault(s => s.Id == id);
                    if (server == null)
                    {
                        if (!m.ShowConnect(true))
                        {
                            return;
                        }
                    }
                    else
                    {
                        m.Connect(server);
                    }
                }
                else
                {
                    Uri server = new Uri(args[0]);
                    m.Connect(server.Host, (server.Port != -1) ? server.Port : 42912);
                }
            }
            else if (Settings.ShowConnectOnStart)
            {
                if (!m.ShowConnect(true))
                {
                    return;
                }
            }

            /*System.Windows.Application app = new System.Windows.Application();
             * app.Run (window);*/

            Application.Run(m);

            Settings.Save();
        }
Beispiel #3
0
 private void OnJoinVoiceMessage(JoinVoiceMessage msg)
 {
     MainForm main = new MainForm();
     main.Connect (msg.Target.Hostname, msg.Target.Port);
     main.Show();
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            if (RaygunKey[0] != '{')
                Raygun = new RaygunClient (RaygunKey);

            AppDomain.CurrentDomain.UnhandledException += (sender, e) => {
                if (StartupLog != null)
                    StartupLog.Error ("Fatal Error", (Exception)e.ExceptionObject);

                if (Raygun != null)
                    Raygun.Send ((Exception) e.ExceptionObject, null, Settings.CurrentSettings);

                MessageBox.Show ("Unexpected error" + Environment.NewLine + (e.ExceptionObject as Exception).ToDisplayString(),
                                 "Unexpected error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            };

            //AutomaticErrorReporter errors = new AutomaticErrorReporter();
            //errors.Add (new GablarskiErrorReporter (typeof(Program).Assembly));

            log4net.Config.XmlConfigurator.Configure ();
            StartupLog = LogManager.GetLogger ("Startup");
            StartupLog.DebugFormat ("PID: {0}", Process.GetCurrentProcess().Id);

            FileInfo program = new FileInfo (Process.GetCurrentProcess().MainModule.FileName);
            Environment.CurrentDirectory = program.Directory.FullName;

            string useLocalValue = ConfigurationManager.AppSettings["useLocalDatabase"];
            bool useLocal;
            Boolean.TryParse (useLocalValue, out useLocal);

            StartupLog.DebugFormat ("Local files: {0}", useLocal);
            StartupLog.DebugFormat ("Setting up databases..");

            ClientData.Setup (useLocal);

            StartupLog.DebugFormat ("Databases setup.");

            CheckForUpdates();

            StartupLog.Debug ("Starting key retrieval");
            var keyCancelSource = new CancellationTokenSource();
            Key = ClientData.GetCryptoKeyAsync (keyCancelSource.Token);
            Key.ContinueWith (t => StartupLog.DebugFormat ("Key retrieval: {0}{1}{2}", t.Status, Environment.NewLine, t.Exception));

            SetupFirstRun();

            if (Settings.Nickname == null)
                PersonalSetup();

            if (!ShowKeyProgress (keyCancelSource))
                return;

            ResourceWebRequestFactory.Register();

            Application.EnableVisualStyles ();
            Application.SetCompatibleTextRenderingDefault (false);

            //SetupSocial();

            /*MainWindow window = new MainWindow();
            window.Show();*/

            var m = new MainForm();
            m.Show();

            UpdateTaskbarServers();

            if (args.Length > 0) {
                int id;
                if (Int32.TryParse (args[0], out id)) {
                    ServerEntry server = Servers.GetEntries ().FirstOrDefault (s => s.Id == id);
                    if (server == null) {
                        if (!m.ShowConnect (true))
                            return;
                    } else
                        m.Connect (server);
                } else {
                    Uri server = new Uri (args[0]);
                    m.Connect (server.Host, (server.Port != -1) ? server.Port : 42912);
                }
            } else if (Settings.ShowConnectOnStart) {
                if (!m.ShowConnect (true))
                    return;
            }

            /*System.Windows.Application app = new System.Windows.Application();
            app.Run (window);*/

            Application.Run (m);

            Settings.Save();
        }