Exemple #1
0
 private void ReloadCockpit(string text)
 {
     if (string.IsNullOrEmpty(text))
     {
         text = "Generic";
     }
     if (cockpit != null)
     {
         //cockpit.Close();
         cockpit.Dispose();
     }
     cockpit               = new frmCockpit();
     cockpit.LogMessage   += DebugMessage;
     cockpit.RequestValue += RequestVariable;
     cockpit.FormClosed   += Cockpit_Closed;
     if (cbFullScreen.Checked)
     {
         cockpit.WindowState     = FormWindowState.Maximized;
         cockpit.FormBorderStyle = FormBorderStyle.None;
     }
     else
     {
         cockpit.WindowState     = FormWindowState.Normal;
         cockpit.Height          = (int)txtCockpitHeight.Value;
         cockpit.Width           = (int)txtCockpitWidth.Value;
         cockpit.FormBorderStyle = FormBorderStyle.FixedDialog;
         cbCockpitCentre_CheckedChanged(null, null);
     }
     cockpit.Text = string.Format("Cockpit{0}", string.IsNullOrEmpty(text) ? "" : (" - " + text));
     cockpit.Show();
     cockpit.LoadLayout(text); // This should force all viible controls to be removed and re-added with new dimensions
     try
     {
         foreach (var requestResult in requestResults)
         {
             try
             {
                 cockpit.ResultUpdate(requestResult);
             }
             catch
             {
                 // If one plugin generates an error, it should not prevent others from being updated
             }
         }
     }
     catch { }
     RequestAllVariables(); // Resubmit all previous requests, in case server disconnected from FS
     cockpit.Focus();
 }
        public void DisplayCockpitInstance()
        {
            frm = new frmCockpit();
            frm.LoadLayout("Cessna 152 ASOBO");
            frm.Show();
            Thread.Sleep(1000);
            var result = GetRequest("INDCATED AIRSPEED", "knots");

            frm.ResultUpdate(result);
            Thread.Sleep(3000);
            result.Result = 100;
            frm.ResultUpdate(result);
            Thread.Sleep(3000);
            result.Result = 200;
            Thread.Sleep(3000);
            frm.Close();
            frm.Dispose();
        }
 public void CreateCockpitInstance()
 {
     frm = new frmCockpit();
     frm.LoadLayout("Cessna 152 ASOBO");
     frm.Dispose();
 }