예제 #1
0
        private void DoubleClickDevice(object sender, EventArgs e)
        {
            var clickedGrid  = (DataGridView)sender;
            var selectedGuid = clickedGrid.CurrentRowStringValue(DevicesBaseCols.DeviceGuid);

            if (!string.IsNullOrEmpty(selectedGuid))
            {
                var device = new Device(selectedGuid);
                ChildFormControl.LookupDevice(this.ParentForm, device);
            }
        }
        private void StartPsExecWindow(Device targetDevice)
        {
            CheckRemoteAccess();

            if (SecurityTools.VerifyAdminCreds())
            {
                var currentInstance = ChildFormControl.FindChildOfType(hostForm, typeof(PSExecCommandForm));

                if (currentInstance == null)
                {
                    new PSExecCommandForm(hostForm, targetDevice);
                }
                else
                {
                    currentInstance.RestoreWindow();
                }
            }
        }
예제 #3
0
        public void ViewDevice(string deviceGuid, bool startHidden = false)
        {
            if (string.IsNullOrEmpty(deviceGuid))
            {
                return;
            }

            try
            {
                if (!ChildFormControl.FormIsOpenByGuid(typeof(ViewDeviceForm), deviceGuid))
                {
                    if (!startHidden)
                    {
                        Waiting();
                    }
                    new ViewDeviceForm(this, new Device(deviceGuid), startHidden);
                }
            }
            catch (Exception ex)
            {
                if (ex is IndexOutOfRangeException)
                {
                    OtherFunctions.Message("That device was not found!  It may have been deleted.  Re-execute your search.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Not Found", this);
                }
                else
                {
                    ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
                }
            }
            finally
            {
                if (!startHidden)
                {
                    DoneWaiting();
                }
            }
        }
예제 #4
0
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += MyApplication_UnhandledException;

            bool connectionSuccessful = false;
            bool cacheAvailable       = false;

            try
            {
                NetworkInfo.LocalDomainUser = Environment.UserName;

                ChildFormControl.SplashScreenInstance().Show();

                ProcessCommandArgs();

                Logging.Logger("Starting AssetManager...");

                Status("Checking Server Connection...");
                connectionSuccessful     = CheckConnection();
                ServerInfo.ServerPinging = connectionSuccessful;

                Status("Checking Cache State...");
                cacheAvailable = DBCacheFunctions.CacheUpToDate(connectionSuccessful);

                // If connected to DB and cache is out-of-date, rebuild it.
                if (connectionSuccessful && !cacheAvailable)
                {
                    Status("Building Cache DB...");

                    Task.Run(() =>
                    {
                        DBCacheFunctions.RefreshLocalDBCache();
                    }).Wait();
                }

                // No DB connection and cache not ready. Don't run.
                if (!connectionSuccessful & !cacheAvailable)
                {
                    OtherFunctions.Message("Could not connect to server and the local DB cache is unavailable.  The application will now close.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "No Connection");
                    Application.Exit();
                    return;
                }
                // No DB connection but cache is ready. Prompt and run.
                else if (!connectionSuccessful & cacheAvailable)
                {
                    GlobalSwitches.CachedMode = true;
                    OtherFunctions.Message("Could not connect to server. Running from local DB cache.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Cached Mode");
                }

                // Try to populate access groups and user from DB.
                Status("Checking Access Level...");
                SecurityTools.PopulateAccessGroups();
                SecurityTools.PopulateUserAccess();

                // Make sure the current user is allowed to run the software.
                if (!SecurityTools.CanAccess(SecurityGroups.CanRun))
                {
                    OtherFunctions.Message("You do not have permission to run this software.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Access Denied");
                    Application.Exit();
                    return;
                }

                Status("Caching Attributes...");
                AttributeFunctions.PopulateAttributeIndexes();

                Status("Collecting Field Info...");
                DBControlExtensions.GetFieldLengths();

                Status("Ready!");
                Application.Run(new UserInterface.Forms.AssetManagement.MainForm());
            }
            catch (Exception ex)
            {
                ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod());
                Application.Exit();
            }
        }
예제 #5
0
 private void InfoLabel_Click(object sender, EventArgs e)
 {
     ChildFormControl.LookupDevice(Helpers.ChildFormControl.MainFormInstance(), currentDevice);
 }