Exemple #1
0
        /// <summary>
        /// Prompt Update grid on screen
        /// </summary>
        /// <param name="obj"></param>
        private void SecurityScoreUpdateClick(object obj)
        {
            if (obj != null)
            {
                ItemUri = obj as string;

                // Open info screen
                if (ShowUpdatePasswordInfo)
                {
                    UpdatePasswordsInfoDialog dlg = new UpdatePasswordsInfoDialog(Application.Current.MainWindow);
                    dlg.DataContext = this;
                    dlg.ShowDialog();

                    if (NeverShowChecked)
                    {
                        IPBData       pbData = resolver.GetInstanceOf <IPBData>();
                        Configuration configDontShowInfoDialog = new Configuration()
                        {
                            AccountEmail = pbData.ActiveUser,
                            Key          = DefaultProperties.Configuration_Key_SecurityScoreInfo,
                            Value        = true.ToString()
                        };
                        pbData.AddOrUpdateConfiguration(configDontShowInfoDialog);
                    }

                    ShowUpdatePasswordInfo = !NeverShowChecked;
                }
                else
                {
                    // Only update password from browser
                    OpenSiteToUpdatePassword();
                }
            }
        }
        private void AlertItemClick(object obj)
        {
            if (obj == null)
            {
                return;
            }
            var a = ((Alert)obj).AlertNotification;

            if (!string.IsNullOrWhiteSpace(a.secure_item_id))
            {
                var _secureItem = db.GetSecureItemById(a.secure_item_id);
                if (_secureItem != null && _secureItem.Site != null)
                {
                    ItemUri = _secureItem.LoginUrl;
                }
            }

            if (a.AlertType == AlertType.SecurityAlert)
            {
                // Open info screen
                if (ShowUpdatePasswordInfo)
                {
                    UpdatePasswordsInfoDialog dlg = new UpdatePasswordsInfoDialog(Application.Current.MainWindow);
                    dlg.DataContext = this;
                    dlg.ShowDialog();


                    if (NeverShowChecked)
                    {
                        Configuration configDontShowInfoDialog = new Configuration()
                        {
                            AccountEmail = db.ActiveUser,
                            Key          = DefaultProperties.Configuration_Key_SecurityScoreInfo,
                            Value        = true.ToString()
                        };
                        db.AddOrUpdateConfiguration(configDontShowInfoDialog);
                    }

                    ShowUpdatePasswordInfo = !NeverShowChecked;
                }

                // Only update password from browser
                else
                {
                    OpenSiteToUpdatePassword();
                }

                //var dictionary = new Dictionary<string, object> { { "id", a.secure_item_id } };
                //((IAppCommand)System.Windows.Application.Current).ExecuteCommand("ShowSecureItemEditor", dictionary);
            }
            else if (a.AlertType == AlertType.NewShare)
            {
                if (((Alert)obj).shareStatus == ShareStatus.Pending)
                {
                    ((MainWindow)Application.Current.MainWindow).MenuSetFocus();
                    var dictionary = new Dictionary <string, object> {
                        { "id", ((Alert)obj).uuid }
                    };
                    ((IAppCommand)System.Windows.Application.Current).ExecuteCommand("ShowShareItemInShareCenter", dictionary);
                }
            }
            if (alertPop != null)
            {
                alertPop.IsOpen = false;
            }
        }