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);
            }
        }
Example #2
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;
                    }
                }
            }
        }
Example #3
0
        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);
              }
        }