/// <summary>
 /// Specifies the status of the current operation.
 /// </summary>
 /// <param name="mode"></param>
 internal void SetMode(PDMODE mode)
 {
     if (_nativeProgressDialog != null && dialogStatus != DIALOGSTATUS.DLG_DISPOSED)
     {
         _nativeProgressDialog.SetMode(mode);
     }
 }
예제 #2
0
        public void OpDlgTest()
        {
            var idlg = new IOperationsProgressDialog();

            idlg.StartProgressDialog(IntPtr.Zero, OPPROGDLGF.OPPROGDLG_DEFAULT);
            idlg.SetOperation(SPACTION.SPACTION_FORMATTING);
            idlg.SetMode(PDMODE.PDM_RUN);
            idlg.UpdateProgress(0, 0, 0, 0, 0, 100);
            var srcd  = new Vanara.Windows.Shell.ShellFolder(KNOWNFOLDERID.FOLDERID_Documents);
            var destd = new Vanara.Windows.Shell.ShellFolder(KNOWNFOLDERID.FOLDERID_Desktop);

            idlg.UpdateLocations(srcd.IShellItem, destd.IShellItem);
            var rnd = new Random();

            for (uint i = 0; i < 100; i++)
            {
                if (idlg.GetOperationStatus() == PDOPSTATUS.PDOPS_CANCELLED)
                {
                    break;
                }
                idlg.UpdateProgress(i * 1024, 102400, i * 1024, 102400, i, 100);
                Thread.Sleep(rnd.Next(50, 250));
            }
            idlg.StopProgressDialog();
        }
예제 #3
0
        public void SetMode(OperationsProgressDialogMode mode)
        {
            if (_dialog == null)
            {
                throw new InvalidOperationException(Resources.ProgressDialogNotRunningError);
            }
            int hr = _dialog.SetMode(mode);

            Marshal.ThrowExceptionForHR(hr);
        }
예제 #4
0
 protected override void RunDialogImpl(IntPtr hwndOwner)
 {
     instance.StartProgressDialog(hwndOwner, (PROGDLG)Options);
     if (action != OperationAction.None)
     {
         instance.SetOperation(action);
     }
     if (mode != OperationMode.None)
     {
         instance.SetMode(mode);
     }
     UpdateLocations();
     UpdateProgress();
 }
        /// <summary>
        /// Shows the dialog with the specified parent. If the parent is null, uses the active form.
        /// </summary>
        /// <param name="parent"></param>
        public void Show(IWin32Window parent)
        {
            if (parent == null)
            {
                parent = Form.ActiveForm;
            }
            IntPtr handle = (parent == null) ? IntPtr.Zero : parent.Handle;

            _nativeProgressDialog = (IOperationsProgressDialog)Activator.CreateInstance(_progressDialogType);
            _nativeProgressDialog.StartProgressDialog(handle, dialogFlags);
            _nativeProgressDialog.SetOperation(operationFlags);
            _nativeProgressDialog.SetMode(modeFlags);
            UpdateProgress();
            dialogStatus = DIALOGSTATUS.DLG_RUNNING;
        }