public void SetViewModel(ViewModelLogIn viewModel) { __LogInViewModel = viewModel; __LogInViewModel.OnAccountCredentailsError += __LogInViewModel_OnAccountCredentailsError; __LogInViewModel.OnWillExecute += (sender) => { EnableView.Disable(View, ignoreControls: new List <NSControl> { GuiButtonLogIn }); CustomButtonStyles.ApplyStyleMainButton(GuiButtonLogIn, LocalizedStrings.Instance.LocalizedString("Button_Cancel")); GuiProgressIndicator.Hidden = false; GuiProgressIndicator.StartAnimation(this); }; __LogInViewModel.OnDidExecute += (sender) => { GuiButtonLogIn.Hidden = false; EnableView.Enable(View, ignoreControls: new List <NSControl> { GuiButtonLogIn }); CustomButtonStyles.ApplyStyleMainButton(GuiButtonLogIn, LocalizedStrings.Instance.LocalizedString("Button_LogIn")); GuiProgressIndicator.Hidden = true; GuiProgressIndicator.StopAnimation(this); }; __LogInViewModel.OnError += __LogInViewModel_OnError; __LogInViewModel.OnAccountSuspended += (AccountStatus session) => { ShowAccountExpireDialog(session); }; __LogInViewModel.PropertyChanged += (sender, e) => { __LogInViewModel_PropertyChanged(sender, e); }; }
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(); }