Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WindowsFormsAero test
#1
WindowsFormsAero test. You'd want to move the constants elsewhere, probably, and change all the paths.
This might be fun to use as a main launcher script if you tweak it. Here I run a local script with the 'Cancel' button.
Also, this only uses the TaskDialog capability of WindowsFormsAero. You might take a look at WindowsFormsAero on github if you want to experiment with its other features, such as Buttons, Progress Bars, Data Controls, thumbnailed windows and Virtual Desktops. Probably many other ways to accomplish these things, though.
Show/hide details is not demonstrated in the animation.

BTW, the nuget name for the package is 'Windows-Forms-Aero'.

   

Code:
 
Code:
Copy      Help
/*/ nuget Forms\Windows-Forms-Aero; /*/
using WindowsFormsAero.TaskDialog;

string filepath1 = pathname.normalize(folders.Documents + @"LibreAutomate\ws17\Files\Animation\rtbEx3.cs");
// adjust 'Main' to your workspace if needed
print.it(filepath1);
/*;CommonButtonResult enums/ids/constant
;These are the IDs you use for functions
;(Everywhere you see "ButtonID" in the code*/
int None = 0;
int OK = 1;
int Cancel = 2;
int Abort = 3;
int Retry = 4;
int Ignore = 5;
int Yes = 6;
int No = 7;
int Close = 8;
/*;************************;

; *******Important * *******;
; These constants are for CREATION only
; Use the IDs above for their function
; Add buttons together for CommonButtons method.
; CustomButtons.cs */
int ButtonOK = 0x0001;
int ButtonCancel = 0x0008;
int ButtonYes = 0x0002;
int ButtonNo = 0x0004;
int ButtonRetry = 0x0010;
int ButtonClose = 0x0020;
/*;**************************;*/


int InformationIcon = 65533;
int WarningIcon = 65535;
int StopIcon = 65534;
int NoIcon = 0;
int SecurityWarning = 65530;
int SecurityErrorIcon = 65529;
int SecuritySuccessIcon = 65528;
int SecurityShieldIcon = 65532;
int SecurityShieldBlueIcon = 65531;                    // ushort.MaxValue is 65535
int SecurityShieldGrayIcon = 65527;

var td = new WindowsFormsAero.TaskDialog.TaskDialog("Task Dialog");


td.CommonButtons = (WindowsFormsAero.TaskDialog.CommonButton)ButtonOK + ButtonYes + ButtonCancel + ButtonNo;
td.ButtonClick += (sender, e) => HandleClick(sender, e);
td.CommonIcon = (WindowsFormsAero.TaskDialog.CommonIcon)SecuritySuccessIcon;
td.FooterCommonIcon = (WindowsFormsAero.TaskDialog.CommonIcon)InformationIcon;
td.Title = "Using WindowsFormsAero with LA";
td.Instruction = "WindowsFormsAero Task Dialog.";
td.Content = "Use long and informative messages, with hyperlinks and linebreaks.\nButtons can be 'Command Link' buttons.\nYou can add radio buttons or a progress bar.";
td.ExpandedInformation = "Click handling takes a little work.";
td.ShowExpandedInfoInFooter = true;
td.Footer = "Use nuget pkg Windows-Forms-Aero";
td.AllowDialogCancellation = true;
/*;;;;; Now for fancy stuff ;;;;;*/
/*;~ td.UseCommandLinks = true*/
td.EnableHyperlinks = true;
td.ProgressBarMinRange = 0;
td.ProgressBarMaxRange = 100;
td.ShowProgressBar = true;
td.SetMarqueeProgressBar(true);
td.SetShieldButton(6, true);


td.Show();

void HandleClick(object sender, ClickEventArgs e) {
    print.it(e.ButtonID.ToString());
    if (e.ButtonID == 1) {
        e.PreventClosing = true;
        dialog.show("Clicked OK");
    }
    if (e.ButtonID == 6) {
        e.PreventClosing = true;
        dialog.show("Clicked Yes");
    }
    if (e.ButtonID == 7) {
        e.PreventClosing = true;
        dialog.show("Clicked No" + Environment.NewLine + "Shield shifts to 'Cancel'");
        td.SetShieldButton(2, true);
        td.SetShieldButton(6, false);
    }
    if (e.ButtonID == 2) {
        script.runWait(filepath1);
    }
}


Regards,
burque505


Forum Jump:


Users browsing this thread: 1 Guest(s)