[wix-users] Custom Progress Dialog

Ven H venh.123 at gmail.com
Tue Mar 6 05:27:32 PST 2018


Thanks a lot, Edwin. I was thinking that it would require the development
of a custom action. So, I tried with the following details.

Custom Action markup in Product.wxs
----------------------------------------------------
<Binary Id="PrgBarCADLL"
SourceFile="$(var.SolutionDir)PrgBarCA\bin\debug\PrgBarCA.CA.dll" />

    <CustomAction Id="CA_ReportProgress" BinaryKey="PrgBarCADLL"
DllEntry="ReportProgress" Execute="immediate" Impersonate="no"
Return="check"></CustomAction>

     <InstallExecuteSequence>
       <Custom Action="CA_ReportProgress"
Before="InstallFiles"><![CDATA[NOT Installed]]></Custom>
    </InstallExecuteSequence>
Custom Action Code
-----------------------------
       [CustomAction]
        public static ActionResult ReportProgress(Session session)
        {
            System.Diagnostics.Debugger.Launch();
            session.Log("Begin ProgressBarCA");
            using (View ssView = session.Database.OpenView("SELECT
`ScriptBinary_` FROM `SqlScript` WHERE `Attributes` = 1"))
            {
                ssView.Execute();
                IEnumerator<Record> ssRecordEnum = ssView.GetEnumerator();
                while (ssRecordEnum.MoveNext())
                {
                    Record ssRecord = ssRecordEnum.Current;
                    string ssKeyValue = ssRecord.GetString(1);

                    using (View binView = session.Database.OpenView("SELECT
`Data` FROM `Binary` WHERE `Name` = '" + ssKeyValue + "'"))
                    {
                        binView.Execute();
                        using (Record binRec = binView.Fetch())
                        {
                            Stream stream = binRec.GetStream("Data");
                            string testData = new StreamReader(stream,
System.Text.Encoding.UTF8).ReadToEnd();
                            session.Log("Test data: " + testData); // gives
only file content and not file name
                        }
                    }
                }
            }
            return ActionResult.Success;
        }
So, as you mentioned earlier, it is only giving file content and not file
name, probably because the Binary table is storing the file information as
Binary Data. So, I am wondering how are many installers able to show the
progress of individual file execution. The other day, I was installing SQL
server on one of the machines. I could see the individual script execution
vividly. I am not able to understand how they achieved it? Is modifying the
custom action from the WiX source code, the only way out?

Regards,
Venkatesh

On Mon, Mar 5, 2018 at 9:46 PM, Edwin Castro <egcastr at gmail.com> wrote:

> I suppose it is technically possible to modify the custom action but you'd
> have to look into it. I've never done that before... It would require
> rebuilding WiX from source... I think you have to contribute your changes
> back to the community if you do
>
> --
> Edwin G. Castro
>
>
> On Sun, Mar 4, 2018 at 9:24 PM, Ven H <venh.123 at gmail.com> wrote:
>
>> Thanks a lot, Edwin. Is it possible to modify that custom action? Are
>> there any steps / samples to achieve that? Also, the progress dialog (even
>> a custom one), runs really quickly. Is there a way to slow it down a bit,
>> by adding a pause or something like that? Please help with your inputs.
>>
>> Regards,
>> Venkatesh
>>
>> On Sat, Mar 3, 2018 at 3:36 AM, Edwin Castro <egcastr at gmail.com> wrote:
>>
>>> That statement applies to standard actions. I already described what the
>>> WiX custom action does. You will not get the names of files unless the WiX
>>> custom action is changed. In fact, the WiX custom action doesn't even keep
>>> track of files. It captures the text of the script (after sanitizing the
>>> script a little) and schedules to execute the content. This allows it to
>>> use a single custom action to execute SqlScript and SqlString (which
>>> doesn't have a file associated with it). You won't be able to do what you
>>> want without modifying the WiX custom action.
>>>
>>> --
>>> Edwin G. Castro
>>>
>>>
>>> On Fri, Mar 2, 2018 at 9:39 AM, Ven H <venh.123 at gmail.com> wrote:
>>>
>>>> If I have many script files and I want to show the detailed progress of
>>>> the individual files, then as per the FireGiant tutorial, (link below), we
>>>> can use the ActionData. I am trying to achieve this, but not sure, if it is
>>>> working or not, or the Custom Progress dialog is even showing or not.
>>>>
>>>>
>>>> https://www.firegiant.com/wix/tutorial/user-interface-revisi
>>>> ted/is-this-progress/
>>>>
>>>>
>>>> Regards,
>>>> Venkatesh
>>>>
>>>> On Fri, Mar 2, 2018 at 12:26 AM, Edwin Castro <egcastr at gmail.com>
>>>> wrote:
>>>>
>>>>> If I'm reading the source code for the version of Wix I'm using
>>>>> (wix39r2rtm) correctly, then a progress message is posted after each script
>>>>> is executed. I would imagine you don't have to do anything special to get
>>>>> the progress bar to increase after each script is executed. There is no
>>>>> text message associated with the progress message (which just updates the
>>>>> progress bar).
>>>>>
>>>>> There is a localized ProgressText for Action="ExecuteSqlStrings" which
>>>>> is the custom action that executes the sql scripts. Then English string is
>>>>> "Executing SQL Strings". If I'm understanding this all correctly, then the
>>>>> progress dialog will display "Executing SQL Strings" while the sql scripts
>>>>> are executing and the progress bar will increase by the amount indicated by
>>>>> COST_SQL_STRING (which is 5000) after each script is executed.
>>>>>
>>>>> --
>>>>> Edwin G. Castro
>>>>>
>>>>>
>>>>> On Thu, Mar 1, 2018 at 10:26 AM, Edwin Castro <egcastr at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> What does "show the progress of each script file" mean?
>>>>>>
>>>>>> I would expect that *IF* SqlScript posts progress messages, then it
>>>>>> probably can only (at most) post one progress message before running the
>>>>>> script and one after running the script. The SqlScript custom action source
>>>>>> code will show whether it posts any progress messages or not.
>>>>>>
>>>>>> --
>>>>>> Edwin G. Castro
>>>>>>
>>>>>>
>>>>>> On Thu, Mar 1, 2018 at 10:02 AM, Ven H via wix-users <
>>>>>> wix-users at lists.wixtoolset.org> wrote:
>>>>>>
>>>>>>> I am trying to execute many SQL scripts as part of my MSI. During
>>>>>>> installation, I have to show the progress of each script file. The
>>>>>>> default
>>>>>>> Progress Dialog runs quickly and doesn't show the progress of
>>>>>>> individual
>>>>>>> scripts. I read that subscribing to ActionData event will help me
>>>>>>> achieve
>>>>>>> this. So, I opened up the source code of WiX and copied the
>>>>>>> ProgressDlg.wxs
>>>>>>> and just updated its Id and changed the following line to
>>>>>>>
>>>>>>>  <Control Id="ActionData" Type="Text" X="70" Y="100" Width="285"
>>>>>>> Height="10">
>>>>>>>     <Subscribe Event="ActionData" Attribute="Text" />
>>>>>>>  </Control>
>>>>>>> which was ActionText before. Also, I changed the line inside the
>>>>>>> InstallUISequence element to below.
>>>>>>> <Show Dialog="CustProgressDlg" After="ProgressDlg" />
>>>>>>>
>>>>>>> In spite of these changes, I am not sure if my custom Progress
>>>>>>> dialog is
>>>>>>> being shown or the same default Progress Dialog is getting shown.
>>>>>>> How do I
>>>>>>> achieve my requirement? Do I really need a Custom Action? What is
>>>>>>> missing?
>>>>>>> Please help.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Venkatesh
>>>>>>>
>>>>>>> ____________________________________________________________________
>>>>>>> WiX Toolset Users Mailing List provided by FireGiant
>>>>>>> http://www.firegiant.com/
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>


More information about the wix-users mailing list