Beispiel #1
0
        private async Task LoadMenu(DateTime date)
        {
            NeedKillVpn = requireVpnOff && EnvCheck.IsVpnConnected();

            if (!IsLoggedIn)
            {
                await InitNetAccess();
            }

            IsCheckAll_normal = false;
            IsCheckAll_ohmori = false;
            IsCheckAll_okazu  = false;
            Bentoes.Clear();

            var bentos = await Net.GetBentoList(date);

            foreach (var item in bentos)
            {
                Bentoes.Add(item);
            }
        }
Beispiel #2
0
 public void OnLoaded()
 {
     NeedBrowserInstall = !EnvCheck.IsMsEdgeInstalled() && !EnvCheck.IsChromeInstalled();
     _ = Update(LoadMenu(selectedDay));
 }
Beispiel #3
0
        static void Main(string[] args)
        {
            //string TheProxyModeInLaunching;
            if (Utils.IsVirusExist())
            {
                return;
            }
#if !_CONSOLE
                foreach (string arg in args)
            {
                if (arg == "--setautorun")
                {
                    if (!AutoStartup.Switch())
                    {
                        Environment.ExitCode = 1;
                    }
                    return;
                }
            }

            using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode()))
            {
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
                Application.EnableVisualStyles();
                Application.ApplicationExit += Application_ApplicationExit;
                SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
                Application.SetCompatibleTextRenderingDefault(false);
                if (!mutex.WaitOne(0, false))
                {
                    MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + "\n" +
                        I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."),
                        I18N.GetString("ShadowsocksR is already running."));
                    return;
                }
#endif
                Directory.SetCurrentDirectory(Application.StartupPath);

#if !_CONSOLE
                int try_times = 0;
                while (Configuration.Load() == null)
                {
                    if (try_times >= 5)
                        return;
                    using (InputPassword dlg = new InputPassword())
                    {
                        if (dlg.ShowDialog() == DialogResult.OK)
                            Configuration.SetPassword(dlg.password);
                        else
                            return;
                    }
                    try_times += 1;
                }
                if (try_times > 0)
                    Logging.save_to_file = false;
#endif
                //#if !DEBUG
                Logging.OpenLogFile();
                //#endif
                _controller = new ShadowsocksController();
                HostMap.Instance().LoadHostFile();

#if _DOTNET_4_0
                // Enable Modern TLS when .NET 4.5+ installed.
                if (EnvCheck.CheckDotNet45())
                ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
#endif
#if !_CONSOLE
                _viewController = new MenuViewController(_controller);
#endif
                HotKeys.Init();
                _controller.Start();

#if !_CONSOLE
                //Util.Utils.ReleaseMemory(true);

                foreach (string arg in args)
                {
                    if (arg == "-Direct")
                    {
                        _viewController.DirectItem_Click();
                        break;
                    }
                    else if(arg == "-Pac")
                    {
                        _viewController.PACModeItem_Click();
                        break;
                    }
                    else if(arg == "-Global")
                    {
                        _viewController.GlobalModeItem_Click();
                        break;
                    }
                }

                Application.Run();
            }
#else
            Console.ReadLine();
            _controller.Stop();
#endif
        }