protected void Close() { if (_connection != null && _connection.State == ConnectionState.Open) { _connection.Close(); _connection = null; OnCloseAction?.Invoke("Zamknięto połączenie z bazą danych"); } else { OnCloseActionERR?.Invoke("NotOpenedDBConnectionException: Baza danych nie jest otwarta."); throw new NotOpenedDBConnectionException("Baza danych nie jest otwarta."); } }
protected void Open() { if (_connectionString == "") { GetConnectionString(); } if (_connection == null) { _connection = new SqlConnection() { ConnectionString = _connectionString, }; _connection.Open(); OnCloseAction?.Invoke("Połączono z bazą danych"); } else { OnCloseActionERR?.Invoke("AlreadyOpenedDBConnectionExeption: Jesteś już połączony z bazą danych."); throw new AlreadyOpenedDBConnectionExeption("Jesteś już połączony z bazą danych."); } }
public virtual void Close() { SoundSystem.PlayOnce(closeSound, 1.0f); canvasGroup.interactable = false; canvasGroup.blocksRaycasts = false; if (closeTween == null || !closeTween.isAlpha) { canvasGroup.alpha = 0f; } else { TweenUtility.SetTween(gameObject, closeTween, 1, () => { if (canvasGroup != null) { canvasGroup.alpha = 0f; } }); } if (OnCloseAction != null) { OnCloseAction.Invoke(); } }
protected override void CloseScope() { base.CloseScope(); GUIStyle style = new GUIStyle(GUI.skin.box); style.fixedHeight = HEIGHT; style.padding = new RectOffset(7, 18, 0, 0); style.margin = new RectOffset(0, 0, 0, 0); style.normal.background = SabreCSGResources.GroupHeaderTexture; #if UNITY_5_4_OR_NEWER style.normal.scaledBackgrounds = new Texture2D[] { SabreCSGResources.GroupHeaderRetinaTexture }; #endif style.font = EditorStyles.miniFont; style.fontSize = 9; style.border = new RectOffset(10, 32, 1, 1); Rect lastRect = GUILayoutUtility.GetLastRect(); scopeRect = lastRect; //GUI.DrawTexture(lastRect, EditorGUIUtility.whiteTexture); lastRect.x += 1; lastRect.y += 1; lastRect.height = style.fixedHeight; lastRect.width = style.CalcSize(new GUIContent(name)).x; GUI.Box(lastRect, name, style); // show actions toolbar: Rect buttonRect = scopeRect; float offset = buttonRect.width - 2; buttonRect.width = 12; buttonRect.height = 12; buttonRect.y += 2; buttonRect.x = offset; buttonRect.x -= IsPopupWindow ? 10 : 0; // close button if (OnCloseAction != null) { if (GUI.Button(buttonRect, new GUIContent(SabreCSGResources.GroupHeaderButtonCloseTexture), GUIStyle.none)) { OnCloseAction.Invoke(); } buttonRect.x -= 14; } // help button if (!string.IsNullOrEmpty(WikiLink)) { if (GUI.Button(buttonRect, new GUIContent(SabreCSGResources.GroupHeaderButtonHelpTexture), GUIStyle.none)) { if (WikiLink.StartsWith("http")) { Application.OpenURL(WikiLink); } else { Application.OpenURL("https://github.com/sabresaurus/SabreCSG/wiki/" + WikiLink); } } buttonRect.x -= 14; } }
private Task Save() { SettingMediators.ForEach(x => x.RequestSave(this)); OnCloseAction?.Invoke(); return(Task.CompletedTask); }