Пример #1
0
        /// <summary>
        /// Handles the Click event of the button_Admin control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void button_Admin_Click(object sender, EventArgs e)
        {
            try
            {
                using (AdminSettingsForm adminForm = new AdminSettingsForm())
                {
                    if (adminForm.ShowDialog(this) == DialogResult.OK)
                    {
                        m_sEncEntity = adminForm.GetAdminEncryptedEntity();

                        if (string.IsNullOrEmpty(m_sEncEntity) == true)
                        {
                            button_RunAs.Enabled = false;
                            button_Add.Enabled   = false;
                        }
                        else
                        {
                            button_RunAs.Enabled = true;
                            button_Add.Enabled   = true;
                            SaveConfig();
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                Logger.WriteError(exp, "3a1a1b93-72e5-45e9-ae88-30f07bab4f29");
            }
        }
Пример #2
0
        ///// <summary>
        ///// Runs as.
        ///// </summary>
        //private void RunAs()
        //{
        //    try
        //    {
        //        AdminEntity admin = new AdminEntity(m_sEncEntity);
        //        ApplicationUnit appUnit = null;

        //        if (listView.SelectedItems.Count > 0)
        //        {
        //            appUnit = (ApplicationUnit)listView.SelectedItems[0].Tag;
        //        }

        //        if (appUnit == null)
        //        {
        //            return;
        //        }

        //        VastAbyss.RunAsEX.StartProcess(admin.UserName
        //                                        , admin.Domain
        //                                        , admin.Password
        //                                        , appUnit.Path);

        //        if (checkBox_CloseWhenRun.Checked == true)
        //        {
        //            button_Exit_Click(null, null);
        //        }
        //    }
        //    catch (Exception exp)
        //    {
        //        Logger.WriteError(exp, "6645a4a8-bab8-4643-af3b-7312bf00e240");
        //    }
        //}
        #endregion @cmnt skislyuk: [12 September 11, 13:47:47]   [110912_134747]


        /// <summary>
        /// Determines whether this instance [can do action].
        /// </summary>
        /// <returns>
        ///     <c>true</c> if this instance [can do action]; otherwise, <c>false</c>.
        /// </returns>
        private bool CanDoAction()
        {
            bool bRetCode = false;

            try
            {
                using (AdminSettingsForm adminForm = new AdminSettingsForm(true))
                {
                    if (adminForm.ShowDialog(this) == DialogResult.OK)
                    {
                        bRetCode = true;
                    }
                }
            }
            catch (Exception exp)
            {
                Logger.WriteError(exp, "9b88c491-a9da-48d0-8d72-3a067e202974");
            }

            return(bRetCode);
        }