TryReadHKLMRegistryString() public static method

public static TryReadHKLMRegistryString ( string name ) : string
name string
return string
コード例 #1
0
        public ExceptionReportingForm(UnhandledExceptionHandler unhandledExceptionHandler,
                                      ReportExceptionEventArgs reportExceptionEventArgs) : this()
        {
            var newHeight = Height;

            this.reportExceptionEventArgs  = reportExceptionEventArgs;
            this.unhandledExceptionHandler = unhandledExceptionHandler;
            errorMessage.Text = reportExceptionEventArgs.Exception.Message;

            newHeight += errorMessage.Height - FontHeight;

            if (!reportExceptionEventArgs.ShowContinueCheckbox)
            {
                continueCheckBox.Visible = false;
                newHeight -= continueCheckBox.Height;
            }

            if (newHeight > Height)
            {
                Height = newHeight;
            }

            if (reportExceptionEventArgs.CanDebug)
            {
                unhandledExceptionHandler.DebuggerLaunched += OnDebuggerLaunched;
                debug.Visible     = true;
                poweredBy.Visible = false;
            }

            if (!reportExceptionEventArgs.CanSendReport)
            {
                sendReport.Enabled = false;
                if (dontSendReport.CanFocus)
                {
                    dontSendReport.Focus();
                }
            }

            email.Text = RegistryHelper.TryReadHKLMRegistryString("Email");

            unhandledExceptionHandler.SendingReportFeedback += OnFeedback;
        }
コード例 #2
0
        protected override Guid GetUserID()
        {
            const string registryString = "AnonymousID";

            try {
                var savedID = RegistryHelper.TryReadHKLMRegistryString(registryString);

                if (savedID.Length == 0)
                {
                    var newID = Guid.NewGuid();
                    RegistryHelper.TrySaveHKLMRegistryString(registryString, newID.ToString("B"));

                    if (RegistryHelper.TryReadHKLMRegistryString(registryString).Length > 0)
                    {
                        return(newID);
                    }
                    return(Guid.Empty);
                }
                return(new Guid(savedID));
            } catch {
                return(Guid.Empty);
            }
        }