MissionPlanner.Controls.Loading.ShowLoading C# (CSharp) Méthode

ShowLoading() public static méthode

Create a new dialog or use an existing one if its still valid
public static ShowLoading ( string Text, IWin32Window owner = null ) : Loading
Text string
owner IWin32Window
Résultat Loading
        public static Loading ShowLoading(string Text, IWin32Window owner = null)
        {
            // ensure we only have one instance at a time
            lock (locker)
            {
                if (Instance != null && !Instance.IsDisposed)
                {
                    Instance.Text = Text;
                    return Instance;
                }

                Loading frm = new Loading();
                frm.TopMost = true;
                frm.StartPosition = FormStartPosition.CenterParent;
                frm.Closing += Frm_Closing;

                // set instance
                Instance = frm;
                // set text
                Instance.label1.Text = Text;

                ThemeManager.ApplyThemeTo(frm);

                // display on ui thread
                if (MainV2.instance.InvokeRequired)
                {
                    MainV2.instance.Invoke((MethodInvoker) delegate
                    {
                        frm.Show(owner);
                        Application.DoEvents();
                    });
                }
                else
                {
                    frm.Show(owner);
                    Application.DoEvents();
                }

                return frm;
            }
        }