Example #1
0
        //function NextButtonClick(CurPageID: Integer): Boolean;
        //var
        //  Position, Max: Integer;
        //begin
        //  if CurPageID = OutputProgressWizardPageAfterID then begin
        //    try
        //      Max := 25;
        //      for Position := 0 to Max do begin
        //        OutputProgressWizardPage.SetProgress(Position, Max);
        //        if Position = 0 then
        //          OutputProgressWizardPage.Show;
        //        Sleep(2000 div Max);
        //        end;
        //    finally
        //      OutputProgressWizardPage.Hide;
        //    end;
        //  end;
        //  Result := True;
        //end;
        public override bool NextButtonClick(int curPageId)
        {
            if (curPageId == OutputProgressWizardPageAfterID)
            {
                try
                {
                    var Max = 25;
                    for (int Position = 0; Position < 25; Position++)
                    {
                        OutputProgressWizardPage.SetProgress(Position, Max);
                        if (Position == 0)
                        {
                            OutputProgressWizardPage.Show();
                        }
                        Sleep(2000 / Max);
                    }
                }
                finally
                {
                    OutputProgressWizardPage.Hide();
                }
            }

            return(true);
        }
Example #2
0
        //function NextButtonClick(CurPageID: Integer): Boolean;
        //var
        //    I: Integer;
        //begin
        //    { Validate certain pages before allowing the user to proceed }
        //    if CurPageID = UserPage.ID then
        //    begin
        //        if UserPage.Values[0] = '' then
        //        begin
        //            MsgBox('You must enter your name.', mbError, MB_OK);
        //            Result := False;
        //        end
        //        else
        //        begin
        //            if DataDirPage.Values[0] = '' then
        //                DataDirPage.Values[0] := 'C:\' + UserPage.Values[0];
        //             Result := True;
        //        end;
        //    end
        //    else
        //        if CurPageID = KeyPage.ID then
        //        begin
        //            { Just to show how 'OutputProgress' pages work.  Always use a try..finally between the Show and Hide calls as shown below. }
        //            ProgressPage.SetText('Authorizing registration key...', '');
        //            ProgressPage.SetProgress(0, 0);
        //            ProgressPage.Show;

        //            try
        //                for I := 0 to 10 do
        //                begin
        //                    ProgressPage.SetProgress(I, 10);
        //                    Sleep(100);
        //                end;
        //            finally
        //                ProgressPage.Hide;
        //            end;
        //            if GetSHA1OfString('codedlg' + KeyPage.Values[0]) = '8013f310d340dab18a0d0cda2b5b115d2dcd97e4' then
        //                Result := True
        //            else
        //            begin
        //                MsgBox('You must enter a valid registration key. (Hint: The key is "inno".)', mbError, MB_OK);
        //                Result := False;
        //            end;
        //        end
        //        else
        //            Result := True;
        //end;
        public override bool NextButtonClick(int curPageId)
        {
            // Validate certain pages before allowing the user to proceed
            if (curPageId == UserPage.ID)
            {
                if (UserPage.Values[0] == "")
                {
                    MsgBox("You must enter your name.", TMsgBoxType.Error, MB.Ok);
                    return(false);
                }
                else if (DataDirPage.Values[0] == "")
                {
                    DataDirPage.Values[0] = "C:\\" + UserPage.Values[0];
                }

                return(true);
            }
            else if (curPageId == KeyPage.ID)
            {
                // Just to show how 'OutputProgress' pages work.
                // Always use a try..finally between the Show and Hide calls as shown below.
                ProgressPage.SetText("Authorizing registration key...", "");
                ProgressPage.SetProgress(0, 0);
                ProgressPage.Show();

                try
                {
                    for (int I = 0; I <= 10; I++)
                    {
                        ProgressPage.SetProgress(I, 10);
                        Sleep(100);
                    }
                }
                finally
                {
                    ProgressPage.Hide();
                }

                if (GetSHA1OfString("codedlg" + KeyPage.Values[0]) == "8013f310d340dab18a0d0cda2b5b115d2dcd97e4")
                {
                    return(true);
                }
                else
                {
                    MsgBox("You must enter a valid registration key. (Hint: The key is \"inno\".)", TMsgBoxType.Error, MB.Ok);
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }