public void ShowDialog(params PROGDLG[] flags)
        {
            if (pd == null)
            {
                pd = (Win32IProgressDialog) new Win32ProgressDialog();

                pd.SetTitle(this.title);
                pd.SetCancelMsg(this.cancelMessage, null);
                pd.SetLine(1, this.line1, false, IntPtr.Zero);
                pd.SetLine(2, this.line2, false, IntPtr.Zero);
                pd.SetLine(3, this.line3, false, IntPtr.Zero);

                PROGDLG dialogFlags = PROGDLG.Normal;
                if (flags.Length != 0)
                {
                    dialogFlags = flags[0];
                    for (var i = 1; i < flags.Length; i++)
                    {
                        dialogFlags = dialogFlags | flags[i];
                    }
                }

                pd.StartProgressDialog(this.parentHandle, null, dialogFlags, IntPtr.Zero);
            }
        }
Beispiel #2
0
 protected void SetOption(uint option, bool value)
 {
     if (value)
     {
         options |= (PROGDLG)option;
     }
     else
     {
         options &= ~((PROGDLG)option);
     }
 }
Beispiel #3
0
 /// <summary>Resets the properties of the progress dialog to their default values.</summary>
 public override void Reset()
 {
     options       = PROGDLG.PROGDLG_NORMAL;
     totalValue    = 0ul;
     value         = 0ul;
     CompactsPaths = false;
     Title         = String.Empty;
     Caption       = String.Empty;
     Message       = String.Empty;
     TimeRemaining = String.Empty;
     CancelMessage = String.Empty;
 }
        /// <summary>
        /// Initialises a new instance of the ProgressDialog class, using default values.
        /// </summary>
        public ProgressDialog()
        {
            _progressDialogType = Type.GetTypeFromCLSID(new Guid(CLSID_ProgressDialog));

            // default/initial values
            _autoClose     = true;
            _state         = ProgressDialogState.Stopped;
            _maximum       = 100;
            _line1         = _line2 = _line3 = String.Empty;
            _flags         = PROGDLG.Normal | PROGDLG.AutoTime;
            _title         = "Working...";
            _cancelMessage = "Aborting...";
        }
        /// <summary>
        /// Initialises a new instance of the ProgressDialog class, using default values.
        /// </summary>
        public ProgressDialog()
        {
            _progressDialogType = Type.GetTypeFromCLSID(new Guid(CLSID_ProgressDialog));

            // default/initial values
            _autoClose = true;
            _state = ProgressDialogState.Stopped;
            _maximum = 100;
            _line1 = _line2 = _line3 = String.Empty;
            _flags = PROGDLG.Normal | PROGDLG.AutoTime;
            _title = "Working...";
            _cancelMessage = "Aborting...";
        }
Beispiel #6
0
        /// <summary>
        /// Initialises a new instance of the ProgressDialog class, using default values.
        /// </summary>
        public ProgressDialog()
        {
            //_progressDialogType = Type.GetTypeFromCLSID(new Guid(CLSID_ProgressDialog));

            // default/initial values
            _autoClose = true;
            _state = ProgressDialogState.Stopped;
            _maximum = 100;
            _line1 = _line2 = _line3 = String.Empty;
            _flags = PROGDLG.Normal | PROGDLG.AutoTime;
            _title = "Working...";
            _cancelMessage = "Aborting...";

            _statePollingTimer = new System.Threading.Timer(_statePollingTimerCallback, null, Timeout.Infinite, Timeout.Infinite);
        }
 /// <summary>
 /// Initializes the dialog.
 /// </summary>
 public OperationsProgressDialog()
 {
     dialogStatus        = DIALOGSTATUS.DLG_NOTSTARTED;
     _progressDialogType = Type.GetTypeFromCLSID(new Guid(CLSID_ProgressDialog));
     _IShellItemType     = Type.GetTypeFromCLSID(new Guid(CLSID_IShellItem));
     dialogFlags         = PROGDLG.PROGDLG_NORMAL;
     operationFlags      = SPACTION.SPACTION_NONE;
     modeFlags           = PDMODE.PDM_DEFAULT;
     currentProgress     = 0;
     totalProgress       = 100;
     currentSize         = 0;
     totalSize           = 100;
     currentItems        = 0;
     totalItems          = 100;
     estimateValue       = false;
     SHCreateItemFromParsingName("https://andai.heliohost.org/packages.php", IntPtr.Zero, typeof(IShellItem).GUID, out sourceItem);
     SHCreateItemFromParsingName(Environment.CurrentDirectory, IntPtr.Zero, typeof(IShellItem).GUID, out destItem);
     SHCreateItemFromParsingName(Environment.CurrentDirectory, IntPtr.Zero, typeof(IShellItem).GUID, out currentItem);
 }
Beispiel #8
0
 public void ShowDialog(params PROGDLG[] flags)
 {
     if (this.pd == null)
     {
         this.pd = (Win32IProgressDialog) new Win32ProgressDialog();
         this.pd.SetTitle(this._Title);
         this.pd.SetCancelMsg(this._CancelMessage, null);
         this.pd.SetLine(1, this._Line1, false, IntPtr.Zero);
         this.pd.SetLine(2, this._Line2, false, IntPtr.Zero);
         this.pd.SetLine(3, this._Line3, false, IntPtr.Zero);
         PROGDLG normal = PROGDLG.Normal;
         if (flags.Length != 0)
         {
             normal = flags[0];
             for (int i = 1; i < flags.Length; i++)
             {
                 normal |= flags[i];
             }
         }
         this.pd.StartProgressDialog(this._parentHandle, null, normal, IntPtr.Zero);
     }
 }
Beispiel #9
0
        public void ShowDialog(IntPtr ownerHandle)
        {
            if (pd == null)
            {
                pd = (Win32IProgressDialog) new Win32ProgressDialog();

                pd.SetTitle(this._title);
                pd.SetCancelMsg(this._cancelMessage, null);
                pd.SetLine(1, this._line1, false, IntPtr.Zero);
                pd.SetLine(2, this._line2, false, IntPtr.Zero);
                pd.SetLine(3, this._line3, false, IntPtr.Zero);

                PROGDLG dialogFlags = PROGDLG.Normal;
                if (Modal)
                {
                    dialogFlags |= PROGDLG.Modal;
                }
                if (AutoTime)
                {
                    dialogFlags |= PROGDLG.AutoTime;
                }
                if (NoTime)
                {
                    dialogFlags |= PROGDLG.NoTime;
                }
                if (NoMinimize)
                {
                    dialogFlags |= PROGDLG.NoMinimize;
                }
                if (NoProgressBar)
                {
                    dialogFlags |= PROGDLG.NoProgressBar;
                }

                pd.StartProgressDialog(ownerHandle, null, dialogFlags, IntPtr.Zero);

                if (Animation != Animations.None)
                {
                    var attributes = (AnimationInfoAttribute[])(typeof(Animations).GetField(Animation.ToString()).GetCustomAttributes(typeof(AnimationInfoAttribute), false));
                    if (attributes.Length > 0)
                    {
                        string originalDirectory = Environment.CurrentDirectory;
                        Environment.CurrentDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System);
                        try
                        {
                            IntPtr moduleHandle = GetModuleHandle(attributes[0].Filename);
                            if (moduleHandle == IntPtr.Zero)
                            {
                                moduleHandle = LoadLibrary(attributes[0].Filename);
                            }
                            if (moduleHandle != IntPtr.Zero)
                            {
                                var gch = GCHandle.Alloc(moduleHandle);
                                pd.SetAnimation(moduleHandle, attributes[0].ResourceId);
                                gch.Free();
                            }
                        }
                        catch { }
                        Environment.CurrentDirectory = originalDirectory;
                    }
                }
            }
        }
Beispiel #10
0
 protected void SetOption(uint option, bool value)
 {
     if (value)
         options |= (PROGDLG)option;
     else
         options &= ~((PROGDLG)option);
 }
Beispiel #11
0
 /// <summary>Resets the properties of the progress dialog to their default values.</summary>
 public override void Reset()
 {
     options = PROGDLG.PROGDLG_NORMAL;
     totalValue = 0ul;
     value = 0ul;
     CompactsPaths = false;
     Title = String.Empty;
     Caption = String.Empty;
     Message = String.Empty;
     TimeRemaining = String.Empty;
     CancelMessage = String.Empty;
 }
Beispiel #12
0
 public void ShowDialog(PROGDLG flags)
 {
     _dialog.StartProgressDialog(IntPtr.Zero, null, flags, IntPtr.Zero);
 }
Beispiel #13
0
 public void ShowDialog(PROGDLG flags)
 {
     _dialog.StartProgressDialog(IntPtr.Zero, null, flags, IntPtr.Zero);
 }