/// <summary> /// Create a new dialog or use an existing one if its still valid /// </summary> /// <param name="Text"></param> /// <returns></returns> 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.Text = Text; frm.TopMost = true; frm.StartPosition = FormStartPosition.CenterParent; ThemeManager.ApplyThemeTo(frm); MainV2.instance.Invoke((MethodInvoker) delegate { frm.Show(owner); Application.DoEvents(); }); Instance = frm; return(frm); } }
/// <summary> /// Create a new dialog or use an existing one if its still valid /// </summary> /// <param name="Text"></param> /// <returns></returns> 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); } }
/// <summary> /// Create a new dialog or use an existing one if its still valid /// </summary> /// <param name="Text"></param> /// <returns></returns> public static void ShowLoading(string Text, IWin32Window owner = null) { log.Info(Text); // create form on ui thread MainV2.instance.BeginInvokeIfRequired((Action) delegate { uiSemaphoreSlim.Wait(); try { if (Instance != null && !Instance.IsDisposed) { Instance.Text = Text; return; } log.Info("Create Instance"); Loading frm = new Loading(); if (owner == null) { frm.TopMost = true; } frm.StartPosition = FormStartPosition.CenterParent; frm.Closing += Frm_Closing; // set instance Instance = frm; // set text Instance.label1.Text = Text; ThemeManager.ApplyThemeTo(frm); frm.Show(owner); frm.Focus(); } finally { uiSemaphoreSlim.Release(); } }); }
/// <summary> /// Create a new dialog or use an existing one if its still valid /// </summary> /// <param name="Text"></param> /// <returns></returns> public static void ShowLoading(string Text, IWin32Window owner = null) { //if (MainV2.MONO) { log.Info(Text); //return; } // ensure we only have one instance at a time lock (locker) { if (Instance != null && !Instance.IsDisposed) { Instance.Text = Text; return; } log.Info("Create Instance"); // create form on ui thread MainV2.instance.Invoke((MethodInvoker) delegate { Loading frm = new Loading(); if (owner == null) { frm.TopMost = true; } frm.StartPosition = FormStartPosition.CenterParent; frm.Closing += Frm_Closing; // set instance Instance = frm; // set text Instance.label1.Text = Text; ThemeManager.ApplyThemeTo(frm); frm.Show(owner); frm.Focus(); }); } }
/// <summary> /// Create a new dialog or use an existing one if its still valid /// </summary> /// <param name="Text"></param> /// <returns></returns> public static Loading ShowLoading(string Text, IWin32Window owner = null) { if (Instance != null && !Instance.IsDisposed) { Instance.Text = Text; return Instance; } Loading frm = new Loading(); frm.Text = Text; frm.TopMost = true; ThemeManager.ApplyThemeTo(frm); MainV2.instance.Invoke((MethodInvoker) delegate { frm.Show(owner); Application.DoEvents(); }); Instance = frm; return frm; }
/// <summary> /// Create a new dialog or use an existing one if its still valid /// </summary> /// <param name="Text"></param> /// <returns></returns> public static Loading ShowLoading(string Text, IWin32Window owner = null) { if (Instance != null && !Instance.IsDisposed) { Instance.Text = Text; return Instance; } Loading frm = new Loading(); frm.Text = Text; frm.TopMost = true; frm.StartPosition = FormStartPosition.CenterParent; ThemeManager.ApplyThemeTo(frm); MainV2.instance.Invoke((MethodInvoker) delegate { frm.Show(owner); Application.DoEvents(); }); Instance = frm; return frm; }
/// <summary> /// Create a new dialog or use an existing one if its still valid /// </summary> /// <param name="Text"></param> /// <returns></returns> 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; } }