示例#1
0
文件: Program.cs 项目: xorkrus/vk_wm
        static void Main()
        {
            // add global exception handler
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            DebugHelper.WriteTraceEntry("-------------------- Start programm --------------------");

            Process[] proc = Process.GetProcesses();
            int i = 0;
            foreach (Process process in proc)
            {
                if (process.ProcessName == "VKontakteWM.exe")
                {
                    i++;
                    if (i > 1)
                    {
                        Application.Exit();
                        return;
                    }
                }
            }

            SystemConfiguration.Init("ВКонтакте", "sysconfig.xml");

            if (PlatformDetection.IsSmartphone() || !(Environment.OSVersion.Version.Major == 5 && Environment.OSVersion.Version.Minor >= 1)) //5.2 - WM6+, 5.1 - WM5))
            {
                MessageBox.Show(Resources.PlatformSupport, SystemConfiguration.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);

                return;
            }

            Cache.InitPath(SystemConfiguration.AppInstallPath + "\\Cache");

            ////make sure we have enough memory to run
            CoreHelper.FreeProgramMemoryIfNeeded(4000);
            // make sure device does not go to sleep during startup
            CoreHelper.KeepDeviceAwake();

            MobileDevice.Hibernate += MobileDevice_Hibernate;

            // Инициализация синглтона бизнес-логики
            Globals.Init(new BaseLogic(new DataLogic(), new CommunicationLogic()));

            // init master form
            MasterForm form = new MasterForm();

            form.Closing += form_Closing;
            form.Initialize();

            Application.Run(form);
        }
示例#2
0
 public MasterForm()
 {
     _master    = this;
     _startTick = Environment.TickCount;
     InitializeComponent();
 }