private void VkAuthButton_Click(object sender, RoutedEventArgs e) { var authorizer = new Authorizer(VkApiSettings.Instance); var url = authorizer.GenerateUrl(); var authorizationForm = new AuthorizationForm(CultureInfo.CurrentCulture, url, VkApiConstants.VkBlankUrl); authorizationForm.Authorized += (o, args) => { var sessionInfo = authorizer.GetSessionInfo(args.Url); var s = 20; }; authorizationForm.ShowDialog(); }
public void Intercept(IInvocation invocation) { var method = invocation.Method; if (method.IsDecoratedBy(typeof(AuthorizationRequiredAttribute))) { var loggedInUser = LoginService.LoggedInUser; var authorizationForm = new AuthorizationForm(); authorizationForm.ShowDialog(); } invocation.Proceed(); }
private void FbAuthButton_Click(object sender, RoutedEventArgs e) { var authorizer = new FacebookApi.Actions.Authorizer(FbApiSettings.Instance); var url = authorizer.GenerateUrl(); var authorizationForm = new AuthorizationForm(CultureInfo.CurrentCulture, url, FbApiConstants.BlankUrl); authorizationForm.Authorized += (o, args) => { var sessionInfo = authorizer.GetSessionInfo(args.Url); var newSessionInfo = authorizer.RenewSessionInfo(sessionInfo); var d = 30; }; authorizationForm.ShowDialog(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); AuthorizationForm AuthForm = new AuthorizationForm(); AuthForm.ShowDialog(); if (AuthForm.DialogResult == DialogResult.OK) { _IsAdmUser = AuthForm.IsAdmUser; Application.Run(new MainForm()); } else { return; } }
private void changeUserToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); AuthorizationForm authForm = new AuthorizationForm(); authForm.StartPosition = FormStartPosition.CenterParent; if (authForm.ShowDialog() == DialogResult.OK) { this.Visible = true; this.employee = authForm.Empl; labelEmp.Text = employee.Name + " " + employee.Surname; returnLaw(); determineLaw(); } else { this.Close(); } }
private void EmplooyersForm_Load(object sender, EventArgs e) { try { Bitmap bitmap = new Bitmap(1, 1); Graphics.FromImage(bitmap).FillRectangle(Brushes.Transparent, new Rectangle(0, 0, 1, 1)); _mainIcon = Icon.FromHandle(bitmap.GetHicon()); } catch { } AuthorizationForm authorizationForm = new AuthorizationForm("CascadeManager", new Messages()); if (authorizationForm.ShowDialog() != DialogResult.OK) { _allowClose = true; Close(); } else { CurrentUser = authorizationForm.User; if (CurrentUser.Role == 2) { btUsers.Enabled = true; } else { btUsers.Enabled = false; } int[] actions = CurrentUser.GetActions(); for (int index = 0; index < actions.Length; ++index) { if (actions[index] == 8) { btObjects.Enabled = true; } if (actions[index] == 7) { btSettings.Enabled = true; } if (actions[index] == 0) { btFaces.Enabled = true; if (_faceForm == null || _faceForm.IsDisposed) { _faceForm = new FrmFaces(); _faceForm.MdiParent = this; } _faceForm.Icon = _mainIcon; _faceForm.Show(); } if (actions[index] == 12) { btStatistic.Enabled = true; } if (actions[index] == 13) { btResults.Enabled = true; } if (actions[index] == 10) { btCategories.Enabled = true; } if (actions[index] == 11) { btWorkStations.Enabled = true; } if (actions[index] == 6) { btSearch.Enabled = true; } if (actions[index] == 17) { btLogSearch.Enabled = true; } if (actions[index] == 4) { btQueryTemplates.Enabled = true; } } } }