Exemplo n.º 1
0
        /// <summary>
        /// 从界面上移除连接
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RemoveConnectionHandler(object sender, EventArgs e)
        {
            ConnectionPanelControl connectionPanel = (ConnectionPanelControl)sender;

            if (_manager.Remove(connectionPanel.viewModel.Id))
            {
                wpConnectionPanels.Children.Remove(connectionPanel);
            }
            MessageBox.Show("删除成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加连接到界面上
        /// </summary>
        /// <param name="connection"></param>
        private void AddConnectionControl(ConnectionViewModel connection)
        {
            // 展现到界面上
            ConnectionPanelControl connectionPanel = new ConnectionPanelControl();

            connectionPanel.Margin = new Thickness(5, 5, 0, 0);
            connectionPanel.Width  = 150.0;
            connectionPanel.Height = 100.0;
            connectionPanel.SetViewModel(connection);
            connectionPanel.RemoveConnectionEventHandler += RemoveConnectionHandler;
            wpConnectionPanels.Children.Add(connectionPanel);
        }