public override void AwakeFromNib() { base.AwakeFromNib(); // Disable title-bar (but keep close/minimize/expand buttons on content-view) Window.TitleVisibility = NSWindowTitleVisibility.Hidden; Window.TitlebarAppearsTransparent = true; Window.StyleMask |= NSWindowStyle.FullSizeContentView; // set window background color //if (!Colors.IsDarkMode) // Window.BackgroundColor = NSColor.FromRgba (255, 255, 255, 0.95f); // Stylyze buttons CustomButtonStyles.ApplyStyleGreyButtonV2(GuiBtnEdit, LocalizedStrings.Instance.LocalizedString("Button_PrivateEmail_Notes")); CustomButtonStyles.ApplyStyleGreyButtonV2(GuiBtnCopy, LocalizedStrings.Instance.LocalizedString("Button_PrivateEmail_Copy")); CustomButtonStyles.ApplyStyleGreyButtonV2(GuiBtnAdd, LocalizedStrings.Instance.LocalizedString("Button_PrivateEmail_Create")); CustomButtonStyles.ApplyStyleGreyButtonV2(GuiBtnDelete, LocalizedStrings.Instance.LocalizedString("Button_PrivateEmail_Delete")); GuiProgressSpiner.StopAnimation(this); GuiProgressSpiner.Hidden = true; GuiBtnRefresh.Hidden = false; // Model event handlers __Model.OnError += (errorText, errorDescription) => { if (Window.IsVisible) { if (string.IsNullOrEmpty(errorDescription)) { IVPNAlert.Show(errorText); } else { IVPNAlert.Show(errorText, errorDescription); } } }; __Model.OnWillExecute += (sender) => { InvokeOnMainThread(() => { __IsUpdateInProgress = true; SetEnableButtons(); GuiInfoLabel.StringValue = LocalizedStrings.Instance.LocalizedString("Label_PrivateEmail_UdpatingProgress"); GuiProgressSpiner.Hidden = false; GuiBtnRefresh.Hidden = true; GuiProgressSpiner.StartAnimation(this); EnableView.Disable(this.GuiTableScrollView); }); }; __Model.OnDidExecute += (sender) => { InvokeOnMainThread(() => { __IsUpdateInProgress = false; SetEnableButtons(); GuiProgressSpiner.Hidden = true; GuiBtnRefresh.Hidden = false; GuiInfoLabel.StringValue = LocalizedStrings.Instance.LocalizedString("Label_PrivateEmail_Title"); EnableView.Enable(this.GuiTableScrollView); }); }; __Model.PropertyChanged += __Model_PropertyChanged; GuiTableEmails.DoubleClick += (sender, e) => OnEdit(null); UpdateGui(); }
void ReleaseDesignerOutlets() { if (GuiBtnAdd != null) { GuiBtnAdd.Dispose(); GuiBtnAdd = null; } if (GuiBtnCopy != null) { GuiBtnCopy.Dispose(); GuiBtnCopy = null; } if (GuiBtnDelete != null) { GuiBtnDelete.Dispose(); GuiBtnDelete = null; } if (GuiBtnEdit != null) { GuiBtnEdit.Dispose(); GuiBtnEdit = null; } if (GuiBtnRefresh != null) { GuiBtnRefresh.Dispose(); GuiBtnRefresh = null; } if (GuiInfoLabel != null) { GuiInfoLabel.Dispose(); GuiInfoLabel = null; } if (GuiLabelEmailsCount != null) { GuiLabelEmailsCount.Dispose(); GuiLabelEmailsCount = null; } if (GuiProgressSpiner != null) { GuiProgressSpiner.Dispose(); GuiProgressSpiner = null; } if (GuiTableEmails != null) { GuiTableEmails.Dispose(); GuiTableEmails = null; } if (GuiTableScrollView != null) { GuiTableScrollView.Dispose(); GuiTableScrollView = null; } }