Exemplo n.º 1
0
        /// <summary>
        /// Gets derived name of specified object.
        /// </summary>
        /// <param name="sender">Sending object from which to derive name.</param>
        /// <returns>Derived name of specified object.</returns>
        public virtual string GetDerivedName(object sender)
        {
            string         name           = null;
            IProvideStatus statusProvider = sender as IProvideStatus;

            if ((object)statusProvider != null)
            {
                name = statusProvider.Name;
            }
            else if (sender is string)
            {
                name = (string)sender;
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                name = sender.GetType().Name;
            }

            if (!string.IsNullOrWhiteSpace(m_name))
            {
                name += "#" + m_name;
            }

            return(name);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets derived name of specified object.
        /// </summary>
        /// <param name="sender">Sending object from which to derive name.</param>
        /// <returns>Derived name of specified object.</returns>
        public virtual string GetDerivedName(object sender)
        {
            return(m_derivedNameCache.GetOrAdd(sender, key =>
            {
                string name = null;
                IProvideStatus statusProvider = key as IProvideStatus;

                if ((object)statusProvider != null)
                {
                    name = statusProvider.Name;
                }
                else if (key is string)
                {
                    name = (string)key;
                }

                if (string.IsNullOrWhiteSpace(name))
                {
                    name = key.GetType().Name;
                }

                if (!string.IsNullOrWhiteSpace(m_name))
                {
                    name += "#" + m_name;
                }

                return name;
            }));
        }
Exemplo n.º 3
0
        public SplashScreen(IProvideStatus progressObject)
        {
            _progressObject = progressObject;
            _progressObject.StatusChange += new StatusChangeHandler(progressObject_OnStatusChange);

            InitializeComponent();
            lblStatus.Text = "";
            _status = new StatusChangeArgs(0, 0, "", "", false);
        }
        public ProgressDialog(string caption, IProvideStatus progressObject)
        {
            InitializeComponent();

            this.Text = caption;
            lblSection.Text = "";
            lblSectionStatus.Text = "";
            lstStatusHistory.Items.Clear();
            status = new StatusChangeArgs(0, 0, "", "", false);

            sections = new List<string>();
            // Default to cancelled status so if the user closes the window at any time the code can cancel out
            // of whatever it is doing correctly
            this.DialogResult = DialogResult.Cancel;

            _progressObject = progressObject;
        }