Beispiel #1
0
        private void LogForm_Load(object sender, EventArgs e)
        {
            InitContent();

            timer          = new Timer();
            timer.Interval = 100;
            timer.Tick    += Timer_Tick;
            timer.Start();

            LogViewerConfig config = controller.GetFreshConfiguration().logViewer;

            Height = config.Height;
            Width  = config.Width;
            Top    = config.BestTop;
            Left   = config.BestLeft;
            if (config.Maximized)
            {
                WindowState = FormWindowState.Maximized;
            }

            topMostTriggerLock = true;
            TopMost            = TopMostMenuItem.Checked = TopMostCheckBox.Checked = topMostTrigger;
            topMostTriggerLock = false;

            wrapTextTriggerLock        = true;
            LogMessageTextBox.WordWrap = WrapTextMenuItem.Checked = WrapTextCheckBox.Checked = wrapTextTrigger;
            wrapTextTriggerLock        = false;

            ToolbarFlowLayoutPanel.Visible = ShowToolbarMenuItem.Checked = toolbarTrigger;
        }
Beispiel #2
0
 private void LoadCurrentConfiguration()
 {
     _modifiedConfiguration          = controller.GetFreshConfiguration().proxy;
     UseProxyCheckBox.Checked        = _modifiedConfiguration.useProxy;
     ProxyServerTextBox.Text         = _modifiedConfiguration.proxyServer;
     ProxyPortTextBox.Text           = _modifiedConfiguration.proxyPort.ToString();
     ProxyTimeoutTextBox.Text        = _modifiedConfiguration.proxyTimeout.ToString();
     ProxyTypeComboBox.SelectedIndex = _modifiedConfiguration.proxyType;
 }
Beispiel #3
0
        public LogForm(ShadowsocksController controller, string filename)
        {
            this.controller = controller;
            this.filename   = filename;
            InitializeComponent();
            Icon = Icon.FromHandle(Resources.logo_128.GetHicon());

            LogViewerConfig config = controller.GetFreshConfiguration().logViewer;

            topMostTrigger              = config.topMost;
            wrapTextTrigger             = config.wrapText;
            toolbarTrigger              = config.toolbarShown;
            LogMessageTextBox.BackColor = config.BackgroundColor;
            LogMessageTextBox.ForeColor = config.TextColor;
            LogMessageTextBox.Font      = config.Font;

            controller.TrafficChanged += controller_TrafficChanged;

            UpdateTexts();
        }
        public MenuViewController()
        {
            LoadMenu();

            controller.EnableStatusChanged         += controller_EnableStatusChanged;
            controller.ConfigChanged               += controller_ConfigChanged;
            controller.PACFileReadyToOpen          += controller_FileReadyToOpen;
            controller.UserRuleFileReadyToOpen     += controller_FileReadyToOpen;
            controller.ShareOverLANStatusChanged   += controller_ShareOverLANStatusChanged;
            controller.VerboseLoggingStatusChanged += controller_VerboseLoggingStatusChanged;
            controller.EnableGlobalChanged         += controller_EnableGlobalChanged;
            controller.Errored += controller_Errored;
            controller.UpdatePACFromGFWListCompleted += controller_UpdatePACFromGFWListCompleted;
            controller.UpdatePACFromGFWListError     += controller_UpdatePACFromGFWListError;

            _notifyIcon = new NotifyIcon();
            UpdateTrayIcon();
            _notifyIcon.Visible            = true;
            _notifyIcon.ContextMenu        = contextMenu1;
            _notifyIcon.BalloonTipClicked += notifyIcon1_BalloonTipClicked;
            _notifyIcon.MouseClick        += notifyIcon1_Click;
            _notifyIcon.MouseDoubleClick  += notifyIcon1_DoubleClick;
            _notifyIcon.BalloonTipClosed  += _notifyIcon_BalloonTipClosed;
            controller.TrafficChanged     += controller_TrafficChanged;

            this.updateChecker = new UpdateChecker();
            updateChecker.CheckUpdateCompleted += updateChecker_CheckUpdateCompleted;

            LoadCurrentConfiguration();

            Configuration config = controller.GetFreshConfiguration();

            if (config.isDefault)
            {
                _isFirstRun = true;
                ShowConfigForm();
            }
            else if (config.autoCheckUpdate)
            {
                _isStartupChecking = true;
                updateChecker.CheckUpdate(config, 3000);
            }
        }
Beispiel #5
0
 private void LoadCurrentConfiguration()
 {
     _modifiedConfig = _controller.GetFreshConfiguration().hotkey;
     LoadConfiguration(_modifiedConfig);
 }