Esempio n. 1
0
        private void Connect()
        {
            try
            {
                Retry.Execute(() =>
                {
                    EnsureClient();

                    MyClients.Add(serviceType, m_WsDualClient);
                    client.Register(serviceType);

                    Initialize();

                    SetRequestParameters(client.GetRequestParameter(ServiceType));
                }, TimeSpan.FromSeconds(2), 1);
                InitialSuccess = true;
            }
            catch (AggregateException ex)
            {
                var msg = "连接不上服务器:" + ex.InnerExceptions.First().Message;
                MessageBox.Show(msg);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
            }
        }
Esempio n. 2
0
        private void btnSample_Click(object sender, EventArgs e)
        {
            var btn = sender as Button;

            var serviceType = ((EServiceType)btn.Tag);

            if (!MyClients.HasAddTagPage(serviceType))
            {
                var service = new ucServiceConfig(serviceType);

                service.Dock = DockStyle.Fill;
                var newTabPage = new TabPage();
                newTabPage.Text = serviceType.ServiceName;
                newTabPage.Controls.Add(service);
                tabControlMain.TabPages.Add(newTabPage);

                if (!service.InitialSuccess)
                {
                    tabControlMain.TabPages.Remove(newTabPage);
                    return;
                }

                MyClients.Add(serviceType, newTabPage);
                tabControlMain.SelectedTab = newTabPage;
            }
            else
            {
                tabControlMain.SelectedTab = MyClients.GetTabPage(serviceType);
            }
        }
Esempio n. 3
0
 private void cmbServiceList_SelectedValueChanged(object sender, EventArgs e)
 {
     if (cmbServiceList.SelectedIndex >= 0)
     {
         var val = cmbServiceList.SelectedItem as WinServiceConfig;
         MyClients.SetCurrentBinding(val.Binding);
         GetLastestStatus();
     }
 }
Esempio n. 4
0
        private void CloseTabPage(Control sourceControl)
        {
            var tabPage = sourceControl as TabPage;

            switch (closeType)
            {
            case ECloseType.Current:
                MyClients.CloseTabPage(tabControlMain.SelectedTab);
                break;

            case ECloseType.AllButThis:
                MyClients.CloseTabPages(exceptTabPage: tabControlMain.SelectedTab);
                break;

            case ECloseType.All:
                MyClients.CloseTabPages(null);
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     MyClients.CloseTabPages(null);
     base.OnFormClosing(e);
 }