コード例 #1
0
 public ChannelForm(SServiceReference.SServiceClient client)
 {
     this.client = client;
     InitializeComponent();
     try
     {
         string[] arrS = client.GetChannels();
         listBox1.Items.AddRange(arrS);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
 public DataForm(SServiceReference.SServiceClient client, string chId)
 {
     this.client = client;
     InitializeComponent();
     nudSmp.Value                   = smp;
     nudInterval.Value              = interval;
     zgc.GraphPane.Title.Text       = chId;
     zgc.GraphPane.XAxis.Title.Text = "Номер отсчета";
     zgc.GraphPane.YAxis.Title.Text = "Сигнал";
     zgc.GraphPane.AddCurve("", new double[] { }, new double[] { }, Color.Green);
     tmr          = new Timer();
     tmr.Interval = interval;
     tmr.Tick    += new EventHandler(tmr_Tick);
     tmr.Start();
 }
コード例 #3
0
ファイル: LogonForm.cs プロジェクト: koanse/SimpleWCFService.
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         client = new SClient.SServiceReference.SServiceClient();
         client.Open();
         client.Auth(textBox1.Text);
         DialogResult = DialogResult.OK;
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         try
         {
             client.Close();
         }
         catch { }
     }
 }
コード例 #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppState state = AppState.Logon;
            string   clId = "", chId = "";

            SServiceReference.SServiceClient client = null;
            while (state != AppState.End)
            {
                switch (state)
                {
                case AppState.Logon:
                    LogonForm lf = new LogonForm(clId);
                    switch (lf.ShowDialog())
                    {
                    case DialogResult.OK:
                        clId   = lf.clId;
                        state  = AppState.Channel;
                        client = lf.client;
                        break;

                    case DialogResult.Abort:
                        state = AppState.End;
                        break;

                    default:
                        state = AppState.End;
                        break;
                    }
                    break;

                case AppState.Channel:
                    ChannelForm cf = new ChannelForm(client);
                    switch (cf.ShowDialog())
                    {
                    case DialogResult.OK:
                        state = AppState.Data;
                        chId  = cf.chId;
                        break;

                    case DialogResult.Abort:
                        state = AppState.End;
                        break;

                    default:
                        state = AppState.End;
                        break;
                    }
                    break;

                case AppState.Data:
                    DataForm df = new DataForm(client, chId);
                    switch (df.ShowDialog())
                    {
                    case DialogResult.Retry:
                        state = AppState.Channel;
                        break;

                    case DialogResult.Cancel:
                        state = AppState.Logon;
                        break;

                    case DialogResult.Abort:
                        state = AppState.End;
                        break;

                    default:
                        state = AppState.End;
                        break;
                    }
                    break;
                }
            }
            try
            {
                client.Close();
            }
            catch { }
        }