Example #1
0
        public MenuViewController(ShadowsocksController controller)
        {
            this.controller = controller;

            LoadMenu();

            controller.ToggleModeChanged       += controller_ToggleModeChanged;
            controller.ToggleRuleModeChanged   += controller_ToggleRuleModeChanged;
            controller.ConfigChanged           += controller_ConfigChanged;
            controller.PACFileReadyToOpen      += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen += controller_FileReadyToOpen;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;
            controller.ShowConfigFormEvent           += Config_Click;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible     = true;
            _notifyIcon.ContextMenu = contextMenu1;
            _notifyIcon.MouseClick += notifyIcon1_Click;
            //_notifyIcon.MouseDoubleClick += notifyIcon1_DoubleClick;

            updateFreeNodeChecker = new UpdateFreeNode();
            updateFreeNodeChecker.NewFreeNodeFound += updateFreeNodeChecker_NewFreeNodeFound;

            LoadCurrentConfiguration();

            Configuration cfg = controller.GetCurrentConfiguration();

            if (cfg.isDefaultConfig() || cfg.nodeFeedAutoUpdate)
            {
                updateFreeNodeChecker.CheckUpdate(controller.GetCurrentConfiguration(), !cfg.isDefaultConfig());
            }
        }
Example #2
0
 public SubscribeWindow(ShadowsocksController controller, UpdateSubscribeManager updateSubscribeManager, UpdateFreeNode updateFreeNodeChecker)
 {
     InitializeComponent();
     I18NUtil.SetLanguage(Resources, @"SubscribeWindow");
     Closed += (o, e) =>
     {
         controller.ConfigChanged -= controller_ConfigChanged;
         SubscribeWindowViewModel.SubscribesChanged -= SubscribeWindowViewModel_SubscribesChanged;
     };
     _controller                = controller;
     _updateSubscribeManager    = updateSubscribeManager;
     _updateFreeNodeChecker     = updateFreeNodeChecker;
     _controller.ConfigChanged += controller_ConfigChanged;
     LoadCurrentConfiguration();
     SubscribeWindowViewModel.SubscribesChanged += SubscribeWindowViewModel_SubscribesChanged;
 }
        public NewMainForm(ShadowsocksController controller)
        {
            this.Font = System.Drawing.SystemFonts.MessageBoxFont;
            InitializeComponent();
            this.Icon       = Icon.FromHandle(Resources.ssw128.GetHicon());
            this.controller = controller;
            LoadCurrentConfiguration();
            UpdateTexts();
            LoadServer();
            updateChecker = new UpdateChecker();
            //Thread t = new Thread(new ThreadStart(show_ping_start));
            //t.Start();
            controller.ConfigChanged += controller_ConfigChanged;

            updateFreeNodeChecker = new UpdateFreeNode();
            updateFreeNodeChecker.NewFreeNodeFound += updateFreeNodeChecker_NewFreeNodeFound;
            updateSubscribeManager = new UpdateSubscribeManager();
            _notifyIcon            = new NotifyIcon();
        }