public static void SetGui(SWIGTYPE_p_AB_BANKING abHandle, IAqGui guiobj) { // retrieve function pointers for callbacks msgdel = new MessageBoxDelegate(guiobj.MessageBox); MessageBoxPtr = Marshal.GetFunctionPointerForDelegate(msgdel); inputdel = new InputBoxDelegate(guiobj.InputBox); InputBoxPtr = Marshal.GetFunctionPointerForDelegate(inputdel); showdel = new ShowBoxDelegate(guiobj.ShowBox); ShowBoxPtr = Marshal.GetFunctionPointerForDelegate(showdel); passwdstatusdel = new SetPasswordStatusDelegate(guiobj.SetPasswordStatus); SetPasswordStatusPtr = Marshal.GetFunctionPointerForDelegate(passwdstatusdel); checkcertdel = new CheckCertDelegate(guiobj.CheckCert); CheckCertPtr = Marshal.GetFunctionPointerForDelegate(checkcertdel); getpassdel = new GetPasswordDelegate(guiobj.GetPassword); GetPasswordPtr = Marshal.GetFunctionPointerForDelegate(getpassdel); // register function pointers to callback gui = AqGui.GWEN_Gui_new(); AqGui.GWEN_Gui_SetMessageBoxFn(gui, MessageBoxPtr); AqGui.GWEN_Gui_SetInputBoxFn(gui, InputBoxPtr); AqGui.GWEN_Gui_SetShowBoxFn(gui, ShowBoxPtr); AqGui.GWEN_Gui_SetSetPasswordStatusFn(gui, SetPasswordStatusPtr); AqGui.GWEN_Gui_SetCheckCertFn(gui, CheckCertPtr); AqGui.GWEN_Gui_SetGetPasswordFn(gui, GetPasswordPtr); AqGui.GWEN_Gui_SetGui(gui); }
static void Main(string[] args) { IntPtr pafishApi = LoadLibrary("pafish.dll"); IntPtr debugAddress = GetProcAddress(pafishApi, "checkGroupDebuggers"); MessageBoxDelegate mbd = (MessageBoxDelegate)Marshal.GetDelegateForFunctionPointer(msgBoxAddress, typeof(MessageBoxDelegate)); mbd(IntPtr.Zero, "A", "B", 0); DoSomething(mbd); }
void ProcessDrag(object obj) { PutLogDelegate putlog = PutLog; MessageBoxDelegate messagebox = ShowMessage; ProgressBarDelegate progress = SetProgress; DateTime curTime = System.DateTime.Now; string time = string.Format("{0}_{1}_{2}-{3}_{4}_{5}", curTime.Year, curTime.Month, curTime.Day, curTime.Hour, curTime.Minute, curTime.Second); Options option = new Options(); option.HeaderRows = 1; option.WorkOut = "输出目录"; option.json = this.checkJson.Checked; option.csv = this.checkCSV.Checked; option.xml = this.checkXml.Checked; option.sqlite = this.checkSqlite.Checked; option.mysql = this.checkMySql.Checked; option.csharp = this.checkCSharp.Checked; option.ExportArray = this.checkArray.Checked; option.SQLPath = string.Format("{0}/{1}", option.WorkOut, time); option.CSharpPath = string.Format("{0}/{1}.cs", option.WorkOut, time); if (Directory.Exists(option.WorkOut) == false) { Directory.CreateDirectory(option.WorkOut); } List <string> list = obj as List <string>; for (int i = 0; i < list.Count; i++) { option.ExcelPath = null; string path = list[i]; if (File.Exists(path)) { option.ExcelPath = path; try { Export(option); } catch (System.Exception e) { this.Invoke(putlog, string.Format("{0}:{1}", option.ExcelPath, e.Message)); } } this.Invoke(progress, (int)((i + 1) / (float)list.Count * 100)); } this.Invoke(messagebox, "导出完成"); }
public static DialogResult MessageBox(IWin32Window owner, string message, MessageBoxButtons messageButtons, MessageBoxIcon messageIcon) { if (((Form)owner).InvokeRequired) { MessageBoxDelegate myDelegate = new MessageBoxDelegate(MessageBox); ((Form)owner).Invoke(myDelegate, new object[] { owner, message, messageButtons, messageIcon }); return(new DialogResult()); } else { MessageBoxBase(message); return(System.Windows.Forms.MessageBox.Show(owner, message, "TETRA Voice Recorder", messageButtons, messageIcon)); } }
public static void Show(string title, string msg, Vector3 pos, MessageBoxButtonState state, MessageBoxDelegate buttonEvent, bool isShowCancel = false) { if (messageBoxClone == null) { Object messageObj = Resources.Load(path); messageBoxClone = GameObject.Instantiate(messageObj) as GameObject; messageBoxClone.transform.SetParent(UIUtility.GetRootCanvas()); messageBoxClone.transform.localScale = new Vector3(2, 2, 2); messageBoxClone.transform.localRotation = Quaternion.Euler(0, 0, 0); messageBoxClone.GetComponent <RectTransform>().anchoredPosition3D = pos; } UIMesageBoxControl uiMessage = messageBoxClone.GetComponent <UIMesageBoxControl>(); uiMessage.Open(); uiMessage.Clear(); uiMessage.SetButtonState(state, isShowCancel); uiMessage.SetTitle(title); uiMessage.SetMessage(msg); uiMessage.SetButtonEvent(buttonEvent); }
public static void Show(string title, string msg, MessageBoxButtonState state, MessageBoxDelegate buttonEvent, bool isShowCancel) { Show(title, msg, Vector2.zero, state, buttonEvent, isShowCancel); }
public static void Show(string title, string msg, MessageBoxDelegate buttonEvent) { Show(title, msg, Vector2.zero, MessageBoxButtonState.OK, buttonEvent); }
public StyledMessageBox(MessageBoxDelegate callback, String message, string windowTitle, MessageType messageType, GuiWidget[] extraWidgetsToAdd, double width, double height, string yesOk, string no) : base(width, height) { responseCallback = callback; unwrappedMessage = message; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); // Creates Header FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; //Creates Text and adds into header { TextWidget elementHeader = new TextWidget(windowTitle, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); topToBottom.AddChild(headerRow); } // Creates container in the middle of window middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { middleRowContainer.HAnchor = HAnchor.ParentLeftRight; middleRowContainer.VAnchor = VAnchor.ParentBottomTop; // normally the padding for the middle container should be just (5) all around. The has extra top space middleRowContainer.Padding = new BorderDouble(5, 5, 5, 15); middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } messageContainer = new TextWidget(message, textColor: ActiveTheme.Instance.PrimaryTextColor); messageContainer.AutoExpandBoundsToText = true; messageContainer.HAnchor = Agg.UI.HAnchor.ParentLeft; middleRowContainer.AddChild(messageContainer); if (extraWidgetsToAdd != null) { foreach (GuiWidget widget in extraWidgetsToAdd) { middleRowContainer.AddChild(widget); } } topToBottom.AddChild(middleRowContainer); //Creates button container on the bottom of window FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight); { BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); } int minButtonWidth = 50; switch (messageType) { case MessageType.YES_NO: { Title = "MatterControl - " + "Please Confirm".Localize(); Button yesButton = textImageButtonFactory.Generate(yesOk, centerText: true); if (yesOk == "") { yesOk = "Yes".Localize(); textImageButtonFactory.FixedWidth = minButtonWidth; yesButton = textImageButtonFactory.Generate(yesOk, centerText: true); textImageButtonFactory.FixedWidth = 0; } yesButton.Width = Math.Max(minButtonWidth, yesButton.Width); yesButton.Click += new EventHandler(okButton_Click); yesButton.Cursor = Cursors.Hand; buttonRow.AddChild(yesButton); //buttonRow.AddChild(new HorizontalSpacer()); Button noButton = textImageButtonFactory.Generate(no, centerText: true); if (no == "") { no = "No".Localize(); textImageButtonFactory.FixedWidth = minButtonWidth; noButton = textImageButtonFactory.Generate(no, centerText: true); textImageButtonFactory.FixedWidth = 0; } noButton.Width = Math.Max(minButtonWidth, noButton.Width); noButton.Click += new EventHandler(noButton_Click); noButton.Cursor = Cursors.Hand; buttonRow.AddChild(noButton); } break; case MessageType.OK: { Title = "MatterControl - " + "Alert".Localize(); Button okButton = textImageButtonFactory.Generate(LocalizedString.Get("Ok"), centerText: true); if (yesOk == "") { yesOk = "Ok".Localize(); textImageButtonFactory.FixedWidth = minButtonWidth; okButton = textImageButtonFactory.Generate(yesOk, centerText: true); textImageButtonFactory.FixedWidth = 0; } okButton.Width = Math.Max(minButtonWidth, okButton.Width); okButton.Cursor = Cursors.Hand; okButton.Click += new EventHandler(okButton_Click); buttonRow.AddChild(okButton); } break; default: throw new NotImplementedException(); } topToBottom.AddChild(buttonRow); this.AddChild(topToBottom); IsModal = true; AdjustTextWrap(); }
public static void ShowMessageBox(MessageBoxDelegate callback, string message, string caption, GuiWidget[] extraWidgetsToAdd, MessageType messageType, string yesOk = "", string no = "") { StyledMessageBox messageBox = new StyledMessageBox(callback, message, caption, messageType, extraWidgetsToAdd, 400, 300, yesOk, no); messageBox.ShowAsSystemWindow(); }
public static void ShowMessageBox(MessageBoxDelegate callback, String message, string caption, MessageType messageType = MessageType.OK, string yesOk = "", string no = "") { ShowMessageBox(callback, message, caption, null, messageType, yesOk, no); }
public static void SetGui(SWIGTYPE_p_AB_BANKING abHandle, IAqGui guiobj) { // retrieve function pointers for callbacks msgdel = new MessageBoxDelegate (guiobj.MessageBox); MessageBoxPtr = Marshal.GetFunctionPointerForDelegate (msgdel); inputdel = new InputBoxDelegate (guiobj.InputBox); InputBoxPtr = Marshal.GetFunctionPointerForDelegate (inputdel); showdel = new ShowBoxDelegate (guiobj.ShowBox); ShowBoxPtr = Marshal.GetFunctionPointerForDelegate (showdel); passwdstatusdel = new SetPasswordStatusDelegate (guiobj.SetPasswordStatus); SetPasswordStatusPtr = Marshal.GetFunctionPointerForDelegate (passwdstatusdel); checkcertdel = new CheckCertDelegate (guiobj.CheckCert); CheckCertPtr = Marshal.GetFunctionPointerForDelegate (checkcertdel); getpassdel = new GetPasswordDelegate (guiobj.GetPassword); GetPasswordPtr = Marshal.GetFunctionPointerForDelegate (getpassdel); // register function pointers to callback gui = AqGui.GWEN_Gui_new (); AqGui.GWEN_Gui_SetMessageBoxFn (gui, MessageBoxPtr); AqGui.GWEN_Gui_SetInputBoxFn (gui, InputBoxPtr); AqGui.GWEN_Gui_SetShowBoxFn (gui, ShowBoxPtr); AqGui.GWEN_Gui_SetSetPasswordStatusFn (gui, SetPasswordStatusPtr); AqGui.GWEN_Gui_SetCheckCertFn (gui, CheckCertPtr); AqGui.GWEN_Gui_SetGetPasswordFn (gui, GetPasswordPtr); AqGui.GWEN_Gui_SetGui (gui); }
static void DoSomething(MessageBoxDelegate mbd) { mbd(IntPtr.Zero, "Work completed.", "Work Progress", 0); }
public StyledMessageBox(MessageBoxDelegate callback, String message, string windowTitle, MessageType messageType, GuiWidget[] extraWidgetsToAdd, double width, double height, string yesOk, string no) : base(width, height) { responseCallback = callback; unwrappedMessage = message; FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom); topToBottom.AnchorAll(); topToBottom.Padding = new BorderDouble(3, 0, 3, 5); // Creates Header FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight); headerRow.HAnchor = HAnchor.ParentLeftRight; headerRow.Margin = new BorderDouble(0, 3, 0, 0); headerRow.Padding = new BorderDouble(0, 3, 0, 3); BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; //Creates Text and adds into header { TextWidget elementHeader = new TextWidget(windowTitle, pointSize: 14); elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor; elementHeader.HAnchor = HAnchor.ParentLeftRight; elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom; headerRow.AddChild(elementHeader); topToBottom.AddChild(headerRow); } // Creates container in the middle of window middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom); { middleRowContainer.HAnchor = HAnchor.ParentLeftRight; middleRowContainer.VAnchor = VAnchor.ParentBottomTop; // normally the padding for the middle container should be just (5) all around. The has extra top space middleRowContainer.Padding = new BorderDouble(5, 5, 5, 15); middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor; } messageContainer = new TextWidget(message, textColor: ActiveTheme.Instance.PrimaryTextColor); messageContainer.AutoExpandBoundsToText = true; messageContainer.HAnchor = Agg.UI.HAnchor.ParentLeft; middleRowContainer.AddChild(messageContainer); if (extraWidgetsToAdd != null) { foreach (GuiWidget widget in extraWidgetsToAdd) { middleRowContainer.AddChild(widget); } } topToBottom.AddChild(middleRowContainer); //Creates button container on the bottom of window FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight); { BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; buttonRow.HAnchor = HAnchor.ParentLeftRight; buttonRow.Padding = new BorderDouble(0, 3); } int minButtonWidth = (int)(50 * TextWidget.GlobalPointSizeScaleRatio + .5); switch (messageType) { case MessageType.YES_NO: { Title = "MatterControl - " + "Please Confirm".Localize(); Button yesButton = textImageButtonFactory.Generate(yesOk, centerText: true); if (yesOk == "") { yesOk = "Yes".Localize(); textImageButtonFactory.FixedWidth = minButtonWidth; yesButton = textImageButtonFactory.Generate(yesOk, centerText: true); textImageButtonFactory.FixedWidth = 0; } yesButton.Width = Math.Max(minButtonWidth, yesButton.Width); yesButton.Click += new EventHandler(okButton_Click); yesButton.Cursor = Cursors.Hand; buttonRow.AddChild(yesButton); //buttonRow.AddChild(new HorizontalSpacer()); Button noButton = textImageButtonFactory.Generate(no, centerText: true); if (no == "") { no = "No".Localize(); textImageButtonFactory.FixedWidth = minButtonWidth; noButton = textImageButtonFactory.Generate(no, centerText: true); textImageButtonFactory.FixedWidth = 0; } noButton.Width = Math.Max(minButtonWidth, noButton.Width); noButton.Click += new EventHandler(noButton_Click); noButton.Cursor = Cursors.Hand; buttonRow.AddChild(noButton); } break; case MessageType.OK: { Title = "MatterControl - " + "Alert".Localize(); Button okButton = textImageButtonFactory.Generate(LocalizedString.Get("Ok"), centerText: true); if (yesOk == "") { yesOk = "Ok".Localize(); textImageButtonFactory.FixedWidth = minButtonWidth; okButton = textImageButtonFactory.Generate(yesOk, centerText: true); textImageButtonFactory.FixedWidth = 0; } okButton.Width = Math.Max(minButtonWidth, okButton.Width); okButton.Cursor = Cursors.Hand; okButton.Click += new EventHandler(okButton_Click); buttonRow.AddChild(okButton); } break; default: throw new NotImplementedException(); } topToBottom.AddChild(buttonRow); this.AddChild(topToBottom); IsModal = true; AdjustTextWrap(); }
public static void ShowMessageBox(MessageBoxDelegate callback, string message, string caption, GuiWidget[] extraWidgetsToAdd, MessageType messageType, string yesOk = "", string no = "") { StyledMessageBox messageBox = new StyledMessageBox(callback, message, caption, messageType, extraWidgetsToAdd, 400, 300, yesOk, no); messageBox.ShowAsSystemWindow(); }
public static void ShowMessageBox(MessageBoxDelegate callback, String message, string caption, MessageType messageType = MessageType.OK, string yesOk = "", string no = "") { ShowMessageBox(callback, message, caption, null, messageType, yesOk, no); }
public void SetButtonEvent(MessageBoxDelegate boxDelegate) { this.onBtnEvent = boxDelegate; }