예제 #1
0
        private void AStrategyItem_Click(object sender, EventArgs e)
        {
            var item = sender as ToolStripMenuItem;

            if (item.Checked)
            {
                return;
            }

            string strategy = item.Text;

            MyShadowsocksController.SetStrategy(strategy);

            foreach (ToolStripItem it in serversItem.DropDownItems)
            {
                if (it.Tag == null)
                {
                    continue;
                }
                var tagString = it.Tag as string;
                if (tagString.StartsWith("server"))
                {
                    it.Enabled = strategy == "Fixed";
                }
                else if (tagString == "strategy")
                {
                    ToolStripMenuItem it2 = it as ToolStripMenuItem;
                    it2.Checked = (it2.Text == App.Config.Strategy);
                }
            }
        }
예제 #2
0
        private void AServer_Click(object sender, EventArgs e)
        {
            var item = sender as ToolStripMenuItem;

            if (item.Checked)
            {
                return;
            }

            var tagString = item.Tag as string;
            int i         = tagString.IndexOf('_');
            int index     = int.Parse(tagString.Substring(i + 1));

            App.Config.Index = index;
            MyShadowsocksController.SetStrategy("Fixed");

            foreach (ToolStripItem it in serversItem.DropDownItems)
            {
                if (it.Tag == null)
                {
                    continue;
                }
                var tagStr = it.Tag as string;
                if (tagStr.StartsWith("server"))
                {
                    (it as ToolStripMenuItem).Checked = tagString == tagStr;
                }
            }
        }