Beispiel #1
0
 public Userinfos(f1 me)
 {
     InitializeComponent();
     if (File.Exists(Application.ExecutablePath + @"\foldericon.ico"))
     {
         Console.WriteLine("EXISTE");
     }
     meform        = me;
     label1.Text   = "Logado na conta: " + Properties.Settings.Default.User;
     textBox3.Text = Properties.Settings.Default.Folder;
     syncount      = 0;
 }
Beispiel #2
0
        static void Main()
        {
            f1 mainForm = null;

            try { int.Parse("dsaj"); }
            catch (Exception ex)
            {
                Console.WriteLine("Linha do  erro " + WinApi.GetLineNumber(ex));
            }
            try
            {
                WinApi.RefreshTrayArea();

                if (!SingleInstance.Start())
                {
                    SingleInstance.ShowFirstInstance();
                    return;
                }
                if (!first)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.ThreadException += new ThreadExceptionEventHandler(ThreadHandler);

                    // Set the unhandled exception mode to force all Windows Forms errors to go through
                    // our handler.
                    Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

                    // Add the event handler for handling non-UI thread exceptions to the event.
                    AppDomain.CurrentDomain.UnhandledException +=
                        new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                }

                if (!f1.logado && !first)
                {
                    mainForm = new f1();

                    Console.WriteLine("firstEnter");

                    if (!mainForm.checkUpdates())
                    {
                        Application.Run(mainForm);
                    }
                    first = true;
                }
                SingleInstance.Stop();
            }
            catch (Exception ex)
            {
                StreamWriter sw = new StreamWriter(Path.Combine(Path.GetTempPath(), "proartelog.txt"), true);
                sw.Write(DateTime.Now + "- " + ex.ToString());
                sw.Write("FECHADO POR ERRO DESCONHECIDO");
                sw.Close();

                Process.GetCurrentProcess().Kill();
                if (mainForm != null)
                {
                    mainForm.Close();
                }
                Application.ExitThread();
                Application.Exit();
            }
        }