Пример #1
0
        private void ButtonCell_Click(object sender, RoutedEventArgs e)
        {
            Button btnSender = ((Button)sender);
            int    configId  = ((ConfigItem)dgData.SelectedValue).Entity.Id;

            switch (btnSender.CommandParameter.ToString())
            {
            case "start":
                if (MyApplication.isListening(configId))
                {
                    MyApplication.stopListen(configId);
                    btnSender.Content = "启动";
                }
                else
                {
                    MyApplication.startListen(configId);
                    btnSender.Content = "停止";
                }
                break;

            case "edit":
                var page = new Page_EditProxy();
                page.Id = configId;
                NavigationService.Navigate(page);
                break;

            case "delete":
                MyManager.DeleteProxyServer(configId);
                loadData();
                break;
            }
        }