public MessageResult Show(string message, string title, MessageIcon icon, MessageOptions option)
        {
            if (_viewModel == null)
                _viewModel = new MessageBoxViewModel(message, title, option, icon);
            else
                _viewModel.Update(message, title, option, icon);

            DispatcherHelper.UIDispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
                {
                    ServiceManager.GetService<IViewService>().OpenDialog(_viewModel);
                }));

            return _viewModel.Result;
        }
        private void OnViewObjectSpaceCommitting(object sender, EventArgs e)
        {
            SalesOrder sorder = (SalesOrder)View.CurrentObject;

            if (sorder.DocumentStatus == DocumentStatus.CreditLimitExceeded)
            {
                string sqlquery = "";
                sqlquery  = " select ";
                sqlquery += " [CreditDaysExceededInvoiceNo]=case when CR_Control ='B' or (CR_Control='S' and isnull((select sy_cbcontrol from einstall),'')='B') then ";
                sqlquery += " isnull((select top 1 b.bill_no from bill b where b.custcode=c.custcode and b.due_date<'" + sorder.DocumentDate.ToString("yyyyMMdd") + "'";
                sqlquery += " and (b.net_amt-isnull((select sum(ca.amount) from customer_adj ca ";
                sqlquery += " where ca.debit_no=b.bill_no and ca.doc_date<='" + sorder.DocumentDate.ToString("yyyyMMdd") + "' and ca.db_type='SB'),0))>0 order by bill_date desc),'') else '' end ";
                sqlquery += " from Customer c where custcode='" + sorder.Customer.ERPCode + "'";

                XpoDefault.DataLayer = XpoDefault.GetDataLayer(MSSqlConnectionProvider.GetConnectionString(sorder.Company.ServerName, sorder.Company.ERPMasterDB + sorder.Company.Initials), AutoCreateOption.None);
                //XpoDefault.DataLayer = XpoDefault.GetDataLayer(MSSqlConnectionProvider.GetConnectionString("ACC00", sorder.Company.ERPMasterDB + sorder.Company.Initials), AutoCreateOption.None);
                XpoDefault.Session = sorder.Session;

                using (var uow = new UnitOfWork())
                {
                    SelectedData sd = uow.ExecuteQuery(sqlquery);
                    foreach (var item in sd.ResultSet)
                    {
                        if (item.Rows[0].Values[0].ToString().Trim() != "")
                        {
                            string errorMessage = string.Empty;
                            errorMessage          = "This invoice number " + item.Rows[0].Values[0].ToString().Trim() + " has been exceeded the Credit Days, Cannot Proceed!";
                            sorder.DocumentStatus = DocumentStatus.CreditLimitExceeded;

                            MessageOptions options = new MessageOptions();
                            options.Duration     = 2000;
                            options.Message      = string.Format(errorMessage);
                            options.Type         = InformationType.Error;
                            options.Web.Position = InformationPosition.Right;
                            options.Win.Caption  = "Error";
                            options.Win.Type     = WinMessageType.Toast;
                            Application.ShowViewStrategy.ShowMessage(options);
                            throw new UserFriendlyException(errorMessage);

                            //return;
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void ReleaseCustomer_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            //  IObjectSpace objectSpace = Application.CreateObjectSpace();
            // SalesRep SR = objectSpace.FindObject<SalesRep>(new BinaryOperator("SalesRepCode", "GOLD MINE"));

            //            if (SR != null)
            //          {
            if (e.SelectedObjects.Count > 0)
            {
                using (IObjectSpace os = Application.CreateObjectSpace())
                {
                    SalesRep SR    = os.FindObject <SalesRep>(new BinaryOperator("SalesRepCode", "GOLD MINE"));
                    int      count = 0;
                    foreach (Customer selectedCustomer in e.SelectedObjects)
                    {
                        Customer cust = os.GetObject <Customer>(selectedCustomer);
                        cust.SalesRep = SR;

                        CustomerRelease custr = os.CreateObject <CustomerRelease>();

                        custr.Customer     = cust;
                        custr.ReleasedBy   = SecuritySystem.CurrentUserName;
                        custr.ReleasedDate = DateTime.Now;
                        custr.Customer.AddNote(custr.Customer, string.Format("Customer was released by {0}", SecuritySystem.CurrentUserName));
                        count++;
                    }
                    os.CommitChanges();
                    MessageOptions options = new MessageOptions();
                    options.Duration     = 3000;
                    options.Message      = string.Format("{0} Customers have been released!", count.ToString());
                    options.Type         = InformationType.Success;
                    options.Web.Position = InformationPosition.Right;
                    options.Win.Caption  = "Success";
                    options.Win.Type     = WinMessageType.Alert;
                    //options.OkDelegate = () => {
                    //    IObjectSpace os1 = Application.CreateObjectSpace(typeof(Customer));
                    // DetailView newTaskDetailView = Application.CreateDetailView(os1, os1.CreateObject<Customer>());
                    // Application.ShowViewStrategy.ShowViewInPopupWindow(newTaskDetailView);
                    //};
                    Application.ShowViewStrategy.ShowMessage(options);
                    View.ObjectSpace.Refresh();
                    View.Refresh();
                }
            }
        }
Ejemplo n.º 4
0
        public void MakeAInitialSmsRequestWithOptionalFieldsTest()
        {
            try
            {
                MessagesRequester messagesRequester = new MessagesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type       messagesRequesterType = typeof(MessagesRequester);
                MethodInfo persyUrlMethodInfo    = messagesRequesterType.GetMethod("setPersyUrl",
                                                                                   BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
                                                                                   null,
                                                                                   new Type[] { typeof(System.String) },
                                                                                   null);
                persyUrlMethodInfo.Invoke(messagesRequester, new Object[] { "http://MakeAInitialSmsRequestTest:3000" });

                WebRequest.RegisterPrefix("http://MakeAInitialSmsRequestTest:3000", new TestWebRequestCreate());

                string         to       = "+18475978014";
                string         from     = "+12248806205";
                string         text     = "Hello World";
                string         notifUrl = "http://server/msgNotif";
                MessageOptions options  = new MessageOptions();
                options.setNotificationUrl(notifUrl);

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"outbound\", \"status\" : \"sending\", \"notificationUrl\" : \"" + notifUrl + "\"}");
                Message msg = messagesRequester.create(from, to, text, options);

                Assert.IsNotNull(msg);
                Assert.IsNotNull(msg.getUri);
                Assert.AreEqual(msg.getUri, "/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892924");
                Assert.AreEqual(msg.getRevision, 1);
                Assert.IsNotNull(msg.getDateCreated);
                Assert.IsNotNull(msg.getDateUpdated);
                Assert.AreEqual(msg.getDirection, com.persephony.EMessageDirection.Outbound);
                Assert.AreEqual(msg.getStatus, com.persephony.EMessageStatus.Sending);
                Assert.AreEqual(msg.getFrom, from);
                Assert.AreEqual(msg.getTo, to);
                Assert.AreEqual(msg.getText, text);
                Assert.AreEqual(msg.getNotificationUrl, notifUrl);
            }
            catch (PersyException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
        async void DisplayToastAnchoredClicked(object?sender, EventArgs args)
        {
            var messageOptions = new MessageOptions
            {
                Message    = "Anchored toast",
                Foreground = Color.Black
            };

            var options = new ToastOptions
            {
                MessageOptions  = messageOptions,
                Duration        = TimeSpan.FromMilliseconds(5000),
                CornerRadius    = new Thickness(10, 20, 30, 40),
                BackgroundColor = Color.LightBlue
            };

            await Anchor1.DisplayToastAsync(options);
        }
Ejemplo n.º 6
0
        private void NewContact_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            CustomerContact cc = (CustomerContact)e.PopupWindowViewCurrentObject;

            e.PopupWindow.View.ObjectSpace.CommitChanges();
            View.ObjectSpace.Refresh();
            MessageOptions options = new MessageOptions();

            options.Message = string.Format("Contact added for :{0}  {1}",
                                            cc.Customers.CustomerName,
                                            cc.FullName);
            options.Type         = InformationType.Success;
            options.Web.Position = InformationPosition.Right;
            options.Win.Caption  = "Success";
            options.Win.Type     = WinMessageType.Alert;
            options.Duration     = 10000;
            Application.ShowViewStrategy.ShowMessage(options);
        }
Ejemplo n.º 7
0
 public virtual void Start(SynchronizationContext synchronizationContext = null)
 {
     synchronizationContext = synchronizationContext ?? SynchronizationContext.Current;
     if (synchronizationContext == null)
     {
         throw new ArgumentNullException(nameof(synchronizationContext));
     }
     if (_platform == Platform.Web)
     {
         _asssignClientHanderSafe(null, Control, "Init", GetInitScript(), "grid.Init");
     }
     _positionSubject
     .Do(SetPosition)
     .Finally(() => SetPosition(0))
     .TakeUntil((_platform == Platform.Win?_breakLinksToControl.AsObservable():Observable.Empty <Unit>()))
     .Subscribe();
     FinishOptions = null;
 }
Ejemplo n.º 8
0
        public MessageResult Show(string message, string title, MessageIcon icon, MessageOptions option)
        {
            if (_viewModel == null)
            {
                _viewModel = new MessageBoxViewModel(message, title, option, icon);
            }
            else
            {
                _viewModel.Update(message, title, option, icon);
            }

            DispatcherHelper.UIDispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
            {
                ServiceManager.GetService <IViewService>().OpenDialog(_viewModel);
            }));

            return(_viewModel.Result);
        }
Ejemplo n.º 9
0
        private static void Show(string message, [NotNull] Notify notify, [CanBeNull] NotifyMessageOptions nMsgOpt,
                                 NotifyType type)
        {
            if (nMsgOpt == null)
            {
                nMsgOpt = new NotifyMessageOptions();
            }
            var msgOpt = new MessageOptions
            {
                CloseClickAction     = n => { nMsgOpt.CloseClickAction?.Invoke(); },
                UnfreezeOnMouseLeave = nMsgOpt.UnfreezeOnMouseLeave,
                FontSize             = nMsgOpt.FontSize,
                FreezeOnMouseEnter   = nMsgOpt.FreezeOnMouseEnter,
                ShowCloseButton      = nMsgOpt.ShowCloseButton,
                Tag = nMsgOpt.Tag,
                NotificationClickAction = n =>
                {
                    n.CanClose = true;
                    n.Close();
                    nMsgOpt.NotificationClickAction?.Invoke();
                }
            };

            switch (type)
            {
            case NotifyType.Information:
                notify.notifier.ShowInformation(message, msgOpt);
                break;

            case NotifyType.Success:
                notify.notifier.ShowSuccess(message, msgOpt);
                break;

            case NotifyType.Warning:
                notify.notifier.ShowWarning(message, msgOpt);
                break;

            case NotifyType.Error:
                notify.notifier.ShowError(message, msgOpt);
                break;

            default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Ejemplo n.º 10
0
        private void SetButtonContent(MessageOptions option)
        {
            switch (option)
            {
            case MessageOptions.MoreInfoCancel:
                LeftButtonContent  = Translation.MoreInfo;
                RightButtonContent = Translation.Cancel;
                break;

            case MessageOptions.OK:
                LeftButtonContent = Translation.Ok;
                break;

            case MessageOptions.OKCancel:
                LeftButtonContent  = Translation.Ok;
                RightButtonContent = Translation.Cancel;
                break;

            case MessageOptions.RetryCancel:
                LeftButtonContent  = Translation.Retry;
                RightButtonContent = Translation.Cancel;
                break;

            case MessageOptions.YesNo:
                LeftButtonContent  = Translation.Yes;
                RightButtonContent = Translation.No;
                break;

            case MessageOptions.YesNoCancel:
                LeftButtonContent   = Translation.Yes;
                RightButtonContent  = Translation.Cancel;
                MiddleButtonContent = Translation.No;
                break;

            case MessageOptions.YesCancel:
                LeftButtonContent  = Translation.Yes;
                RightButtonContent = Translation.Cancel;
                break;
            }

            RaisePropertyChanged(nameof(RightButtonContent));
            RaisePropertyChanged(nameof(MiddleButtonContent));
            RaisePropertyChanged(nameof(LeftButtonContent));
        }
Ejemplo n.º 11
0
        private static void ShowToastInformation(string message, bool autoClear, Corner position)
        {
            if (notifier == null)
            {
                notifier = new Notifier(cfg =>
                {
                    cfg.PositionProvider = new WindowPositionProvider(
                        parentWindow: DesktopApplication.MainWindow,

                        corner: position,
                        offsetX: 75,
                        offsetY: 100);
                    if (autoClear)
                    {
                        cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                            notificationLifetime: TimeSpan.FromSeconds(3),
                            maximumNotificationCount: MaximumNotificationCount.FromCount(6));
                    }
                    else
                    {
                        cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                            notificationLifetime: TimeSpan.FromHours(1),
                            maximumNotificationCount: MaximumNotificationCount.FromCount(6));
                    }

                    cfg.DisplayOptions.TopMost = true;
                    cfg.DisplayOptions.Width   = 400;
                    cfg.Dispatcher             = DesktopApplication.Dispatcher;
                });
            }


            var options = new MessageOptions
            {
                CloseClickAction     = CloseAction,
                FontSize             = 14, // set notification font size
                FreezeOnMouseEnter   = true,
                UnfreezeOnMouseLeave = true,
                ShowCloseButton      = true
            };


            notifier.ShowInformation(message, options);
        }
Ejemplo n.º 12
0
        async void DisplaySnackBarAdvancedClicked(object sender, EventArgs args)
        {
            var messageOptions = new MessageOptions
            {
                Foreground = Color.DeepSkyBlue,
                FontSize   = 40,
                FontFamily = "Sans-serif",
                Message    = GenerateLongText(5)
            };

            var actionOptions = new List <SnackBarActionOptions>
            {
                new SnackBarActionOptions
                {
                    ForegroundColor = Color.Red,
                    BackgroundColor = Color.Green,
                    FontSize        = 40,
                    FontFamily      = "Sans-serif",
                    Text            = "Action1",
                    Action          = () =>
                    {
                        Debug.WriteLine("1");
                        return(Task.CompletedTask);
                    }
                },
                new SnackBarActionOptions
                {
                    ForegroundColor = Color.Green,
                    BackgroundColor = Color.Red,
                    FontSize        = 20,
                    FontFamily      = "Sans-serif",
                    Text            = "Action2",
                    Action          = () =>
                    {
                        Debug.WriteLine("2");
                        return(Task.CompletedTask);
                    }
                }
            };
            var options = new SnackBarOptions(messageOptions, 5000, Color.Coral, true, actionOptions);
            var result  = await this.DisplaySnackBarAsync(options);

            StatusText.Text = result ? AppResources.SnackBarIsClosedByUser : AppResources.SnackBarIsClosedByTimeout;
        }
Ejemplo n.º 13
0
        private async void BtnFail_Clicked(object sender, EventArgs e)
        {
            char ch             = (char)0x26A0;
            var  messageOptions = new MessageOptions
            {
                Foreground = Color.White,
                Font       = Font.SystemFontOfSize(16),
                Padding    = 100,
                Message    = ch + "  Error Message "
            };
            var options = new ToastOptions
            {
                BackgroundColor = Color.FromHex("#f3a447"),
                MessageOptions  = messageOptions,
                Duration        = TimeSpan.FromMilliseconds(3000)
            };

            await this.DisplayToastAsync(options);
        }
Ejemplo n.º 14
0
        public async Task SayAsync_ShouldSendTextAndAttachments()
        {
            var dialog = Chain.PostToChain().Do(async(context, activity) =>
            {
                var messageOptions = new MessageOptions
                {
                    Attachments =
                    {
                        new Attachment
                        {
                            ContentType = "foo",
                            Content     = "bar"
                        }
                    }
                };
                await context.SayAsync("some text", options: messageOptions);
            });

            using (var container = Build(Options.None))
            {
                var toBot = MakeTestMessage();
                toBot.Text = "hi";
                await new TestAdapter().ProcessActivityAsync((Activity)toBot, async(context, cancellationToken) =>
                {
                    using (var scope = DialogModule.BeginLifetimeScope(container, context))
                    {
                        DialogModule_MakeRoot.Register(scope, () => dialog);

                        var task = scope.Resolve <IPostToBot>();

                        await task.PostAsync(toBot, CancellationToken.None);

                        await AssertOutgoingActivity(scope, (toUser) =>
                        {
                            Assert.AreEqual("some text", toUser.Text);
                            Assert.IsNull(toUser.Speak);
                            Assert.AreEqual(1, toUser.Attachments.Count());
                            Assert.AreEqual("foo", toUser.Attachments[0].ContentType);
                        });
                    }
                });
            };
        }
Ejemplo n.º 15
0
        private void newpo_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            ItemPurchaseOrder po = (ItemPurchaseOrder)e.PopupWindowViewCurrentObject;

            MessageOptions options = new MessageOptions();

            options.Duration     = 20000;
            options.Message      = string.Format("Purchase Order for {0} has been entered", po.Vendor.VendorName);
            options.Type         = InformationType.Success;
            options.Web.Position = InformationPosition.Right;
            options.Win.Caption  = "Success";
            options.Win.Type     = WinMessageType.Alert;
            //options.OkDelegate = () => {
            //    IObjectSpace os = Application.CreateObjectSpace(typeof(Customer));
            // DetailView newTaskDetailView = Application.CreateDetailView(os, os.CreateObject<ItemRequest>());
            // Application.ShowViewStrategy.ShowViewInPopupWindow(newTaskDetailView);
            //};
            Application.ShowViewStrategy.ShowMessage(options);
        }
        public static Task <bool> DisplayToastAsync(this Page page, string message, int duration = 3000)
        {
            var messageOptions = new MessageOptions {
                Message = message
            };
            var args = new SnackBarOptions(messageOptions,
                                           duration,
                                           Color.Default,
#if NETSTANDARD1_0
                                           false,
#else
                                           CultureInfo.CurrentCulture.TextInfo.IsRightToLeft,
#endif
                                           new List <SnackBarActionOptions>());
            var snackBar = new SnackBar();

            snackBar.Show(page, args);
            return(args.Result.Task);
        }
        private void CopyToDO_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            SalesOrder currentObject = (SalesOrder)View.CurrentObject;

            if (ObjectSpace.IsModified || ObjectSpace.IsNewObject(currentObject))
            {
                MessageOptions options = new MessageOptions();
                options.Message  = "Please save the document 1st.";
                options.Duration = 3000;
                options.Type     = InformationType.Error;
                Application.ShowViewStrategy.ShowMessage(options);
                return;
            }
            IObjectSpace  ios           = Application.CreateObjectSpace();
            DeliveryOrder deliveryOrder = ios.CreateObject <DeliveryOrder>();

            deliveryOrder.CustomerID = deliveryOrder.Session.FindObject <Customers>(new BinaryOperator("Oid", currentObject.CompanyID.Oid));
            foreach (SalesOrderDetail item in currentObject.OrderDetail)
            {
                if (item.OpenQuantity <= 0)
                {
                    continue;
                }
                DeliveryOrderDetail orderDetail = ios.CreateObject <DeliveryOrderDetail>();
                orderDetail.Item     = ios.FindObject <Items>(new BinaryOperator("Oid", item.Item.Oid));
                orderDetail.Item     = ios.GetObjectByKey <Items>(item.Item.Oid);
                orderDetail.Quantity = item.OpenQuantity;
                orderDetail.Price    = item.Price;
                orderDetail.BaseObj  = "Order";
                orderDetail.BaseLine = item.Oid;
                deliveryOrder.OrderDetail.Add(orderDetail);
            }

            ShowViewParameters svp = new ShowViewParameters();
            DetailView         dv  = Application.CreateDetailView(ios, deliveryOrder);

            dv.ViewEditMode = ViewEditMode.Edit;
            dv.IsRoot       = true;
            svp.CreatedView = dv;

            Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
        }
        private void _SendMessage(string text)
        {
            //Put the user's text into a message part, which has a MIME type of "text/plain" by default
            MessagePart messagePart = layerClient.NewMessagePart(text);

            //Formats the push notification that the other participants will receive
            MessageOptions options = new MessageOptions();

            options.InvokePushNotificationMessage(MainActivity.GetUserID() + ": " + text);

            //Creates and returns a new message object with the given conversation and array of
            // message parts
            IMessage message = layerClient.NewMessage(options, messagePart);

            //Sends the message
            if (activeConversation != null)
            {
                activeConversation.Send(message);
            }
        }
Ejemplo n.º 19
0
        private void DrugRequestAction_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            e.PopupWindow.View.ObjectSpace.CommitChanges();
            View.ObjectSpace.Refresh();
            View.Refresh();
            MessageOptions options = new MessageOptions();

            options.Duration     = 20000;
            options.Message      = string.Format("{0} Request have been successfully updated!", e.PopupWindow.Application.Title);
            options.Type         = InformationType.Success;
            options.Web.Position = InformationPosition.Right;
            options.Win.Caption  = "Success";
            options.Win.Type     = WinMessageType.Flyout;
            //options.OkDelegate = () => {
            //    IObjectSpace os = Application.CreateObjectSpace(typeof(Customer));
            // DetailView newTaskDetailView = Application.CreateDetailView(os, os.CreateObject<ItemRequest>());
            // Application.ShowViewStrategy.ShowViewInPopupWindow(newTaskDetailView);
            //};
            Application.ShowViewStrategy.ShowMessage(options);
        }
Ejemplo n.º 20
0
        private async void BtnToast_Clicked(object sender, EventArgs e)
        {
            char ch             = (char)0x2714;
            var  messageOptions = new MessageOptions
            {
                Foreground = Color.White,
                Font       = Font.SystemFontOfSize(16),
                Message    = ch + "  Success message with tick"
            };
            var options = new ToastOptions
            {
                BackgroundColor = Color.Green,
                MessageOptions  = messageOptions,
                Duration        = TimeSpan.FromMilliseconds(3000)
            };

            await this.DisplayToastAsync(options);

            //kcawait this.DisplayToastAsync("ok", 500);
        }
        public static Task DisplayToastAsync(this Page page, string message, int durationMilliseconds = 3000)
        {
            var messageOptions = new MessageOptions {
                Message = message
            };
            var args = new SnackBarOptions
            {
                MessageOptions = messageOptions,
                Duration       = TimeSpan.FromMilliseconds(durationMilliseconds),
#if NETSTANDARD1_0
                IsRtl = false,
#else
                IsRtl = CultureInfo.CurrentCulture.TextInfo.IsRightToLeft,
#endif
            };
            var snackBar = new SnackBar();

            snackBar.Show(page, args);
            return(args.Result.Task);
        }
Ejemplo n.º 22
0
        private MessageBoxButton GetMessageBoxButton(MessageOptions options)
        {
            switch (options)
            {
            case MessageOptions.Ok:
                return(MessageBoxButton.OK);

            case MessageOptions.OkCancel:
                return(MessageBoxButton.OKCancel);

            case MessageOptions.YesNo:
                return(MessageBoxButton.YesNo);

            case MessageOptions.YesNoCancel:
                return(MessageBoxButton.YesNoCancel);

            default:
                throw new NotSupportedException($"The {options} are not supported in method '{nameof(GetMessageBoxButton)}'!");
            }
        }
Ejemplo n.º 23
0
        private void FilteringCriterionAction_Execute(object sender, SingleChoiceActionExecuteEventArgs e)
        {
            ((ListView)View).CollectionSource.BeginUpdateCriteria();
            ((ListView)View).CollectionSource.Criteria.Clear();
            ((ListView)View).CollectionSource.Criteria[e.SelectedChoiceActionItem.Caption] =
                CriteriaEditorHelper.GetCriteriaOperator(
                    e.SelectedChoiceActionItem.Data as string, View.ObjectTypeInfo.Type, ObjectSpace);
            ((ListView)View).CollectionSource.EndUpdateCriteria();


            MessageOptions options = new MessageOptions();

            options.Duration     = 2000;
            options.Message      = string.Format("{0} filtro ha sido aplicado...", e.SelectedChoiceActionItem.Caption);
            options.Type         = InformationType.Success;
            options.Web.Position = InformationPosition.Bottom;
            options.Win.Caption  = "Filtro";
            options.Win.Type     = WinMessageType.Toast;

            Application.ShowViewStrategy.ShowMessage(options);
        }
Ejemplo n.º 24
0
        private void CustomerLicVerification_Execute(object sender, PopupWindowShowActionExecuteEventArgs e)
        {
            e.PopupWindow.View.ObjectSpace.CommitChanges();

            IObjectSpace objectSpace         = Application.CreateObjectSpace();
            CustomerLicenseVerifications clr = objectSpace.CreateObject <CustomerLicenseVerifications>();

            MessageOptions options = new MessageOptions();

            options.Duration     = 3000;
            options.Message      = string.Format("{0} Varified Dea Number of {1} with the Exp date of: {2}  updated!", "", clr.LicenseNumber, clr.LicenseExpirationDate);
            options.Type         = InformationType.Success;
            options.Web.Position = InformationPosition.Right;
            options.Win.Caption  = "Success";
            options.Win.Type     = WinMessageType.Alert;

            Application.ShowViewStrategy.ShowMessage(options);

            View.ObjectSpace.Refresh();
            View.Refresh();
        }
        private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result)
        {
            var activity = await result as Activity;

            var options = new MessageOptions
            {
                InputHint = InputHints.AcceptingInput
            };

            try
            {
                if (activity.Type == "exception")
                {
                    await PostExceptionAsync(context, activity, activity.Value as Exception);
                }
                else if (activity.Text.ToLower().Contains("end") || activity.Text.ToLower().Contains("stop"))
                {
                    // Send an `endOfconversation` activity if the user cancels the skill.
                    await context.SayAsync($"Ending conversation from the skill...", options : options);

                    var endOfConversation = activity.CreateReply();
                    endOfConversation.Type      = ActivityTypes.EndOfConversation;
                    endOfConversation.Code      = EndOfConversationCodes.CompletedSuccessfully;
                    endOfConversation.InputHint = InputHints.AcceptingInput;
                    await context.PostAsync(endOfConversation);
                }
                else
                {
                    await context.SayAsync($"Echo: {activity.Text}", options : options);

                    await context.SayAsync($"Say \"end\" or \"stop\" and I'll end the conversation and back to the parent.", options : options);
                }
            }
            catch (Exception exception)
            {
                await PostExceptionAsync(context, activity, exception);
            }

            context.Wait(MessageReceivedAsync);
        }
Ejemplo n.º 26
0
        static void Main(string[] args)
        {
            // Message
            string message = "";
            // Condition to send message
            bool send_msg_condition;

            /// <summary>
            /// Message Options - Required
            ///    -- Used to interact with the Broker
            ///    -- Default Options setup to work with default settings for Broker
            ///    -- Set properties to match your environment, <see cref="MessageOptions"/>
            /// </summary>
            var message_options = new MessageOptions();

            Console.WriteLine(" --- Welcome, when done input exit to exit ---");

            using (var sender = new MessageSender(message_options))
            {
                do
                {
                    // Print
                    Console.WriteLine();
                    Console.Write("Please input name: ");

                    // Get name
                    message = Console.ReadLine();


                    // Set condition to send message: send message if name has value and value not exit
                    send_msg_condition = !String.IsNullOrEmpty(message) && !message.Equals("exit", StringComparison.CurrentCultureIgnoreCase);

                    // Condition to send message met
                    if (send_msg_condition)
                    {
                        sender.send(String.Format("Hello my name is, {0}", message));
                    }
                } while (!message.Equals("exit", StringComparison.CurrentCultureIgnoreCase));
            }
        }
Ejemplo n.º 27
0
        private void InitialDataEntryController_Activated(object sender, EventArgs e)
        {
            //เริ่มสร้าง
            OpenSendScore oss = ObjectSpace.FindObject <OpenSendScore>(CriteriaOperator.Parse("Open = ?", true));

            if (oss != null)
            {
                if (oss.ERound != null)
                {
                    Employee owner  = ObjectSpace.GetObjectByKey <Employee>(SecuritySystem.CurrentUserId);
                    Score    oscore = ObjectSpace.FindObject <Score>(CriteriaOperator.Parse("ERound = ? AND Office=?", oss.ERound, 995));
                    if (oscore == null)
                    {
                        CreateAll(oss, owner);
                    }
                    else
                    {
                        MessageOptions options = new MessageOptions();
                        options.Duration     = 2000;
                        options.Message      = string.Format("{0} มีการสร้างตารางข้อมูลแล้ว!!!", oss.ERound.Title);
                        options.Type         = InformationType.Error;
                        options.Web.Position = InformationPosition.Top;
                        options.Win.Caption  = "Error";
                        options.Win.Type     = WinMessageType.Flyout;
                        Application.ShowViewStrategy.ShowMessage(options);
                    }
                }
            }
            else
            {
                MessageOptions options = new MessageOptions();
                options.Duration     = 2000;
                options.Message      = string.Format("ยังไม่เปิดให้บันทึกข้อมูล หรือ ไม่มีรอบประเมินที่เปิด!!!");
                options.Type         = InformationType.Error;
                options.Web.Position = InformationPosition.Top;
                options.Win.Caption  = "Error";
                options.Win.Type     = WinMessageType.Flyout;
                Application.ShowViewStrategy.ShowMessage(options);
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Display toast with the default visual configuration
        /// </summary>
        /// <param name="visualElement">Toast anchor</param>
        /// <param name="message">Toast text</param>
        /// <param name="durationMilliseconds">Toast duration (milliseconds)</param>
        /// <returns>Task</returns>
        public static async Task DisplayToastAsync(this VisualElement visualElement, string message, int durationMilliseconds = 3000)
        {
            _ = visualElement ?? throw new ArgumentNullException(nameof(visualElement));

            var messageOptions = new MessageOptions {
                Message = message
            };
            var args = new SnackBarOptions
            {
                MessageOptions = messageOptions,
                Duration       = TimeSpan.FromMilliseconds(durationMilliseconds),
#if NETSTANDARD1_0
                IsRtl = false,
#else
                IsRtl = CultureInfo.CurrentCulture.TextInfo.IsRightToLeft,
#endif
            };
            var snackBar = new SnackBar();
            await snackBar.Show(visualElement, args);

            await args.Result.Task;
        }
Ejemplo n.º 29
0
        public static void ShowSuccessMessage(XafApplication Application, string Message, InformationPosition Position)
        {
            Employee employee = GetEmployee(Application);

            MessageOptions options = new MessageOptions {
                Duration = 5000,
                Message  = string.Format(Message),
                Type     = InformationType.Success
            };

            options.Web.Position = Position;
            Application.ShowViewStrategy.ShowMessage(options);

            if (employee != null)
            {
                ExceptionlessClient.Default.CreateLog(ExceptionSources.MyWorkbenchCloud.ToString(), Message, LogLevel.Info.ToString()).SetUserDescription(employee.Email, employee.FullName);
            }
            else
            {
                ExceptionlessClient.Default.CreateLog(ExceptionSources.MyWorkbenchCloud.ToString(), Message, LogLevel.Info.ToString());
            }
        }
Ejemplo n.º 30
0
        public static void ShowErrorMessage(XafApplication Application, Exception Exception, InformationPosition Position)
        {
            Employee employee = GetEmployee(Application);

            MessageOptions options = new MessageOptions {
                Duration = 5000,
                Message  = string.Format(Exception == null ? "Unknown Error" : Exception.ToString()),
                Type     = InformationType.Error
            };

            options.Web.Position = Position;
            Application.ShowViewStrategy.ShowMessage(options);

            if (employee != null)
            {
                ExceptionlessClient.Default.CreateLog("My Workbench", Exception.ToString(), LogLevel.Error.ToString()).MarkAsCritical().SetUserDescription(employee.Email, employee.FullName);
            }
            else
            {
                ExceptionlessClient.Default.CreateLog("My Workbench", Exception.ToString(), LogLevel.Error.ToString()).MarkAsCritical();
            }
        }
Ejemplo n.º 31
0
        static void Main(string[] args)
        {
            /// <summary>
            /// Message Options - Required
            ///    -- Used to interact with the Broker
            ///    -- Default Options setup to work with default settings for Broker
            ///    -- Set properties to match your environment, <see cref="MessageOptions"/>
            /// </summary>
            var message_options = new MessageOptions();

            Console.WriteLine(" --- Welcome, waiting for messages ---");
            Console.WriteLine();

            using (var receiver = new MessageReceiver(message_options))
            {
                // Print messages
                receiver.Receive();

                Console.WriteLine("Press [enter] to exit.");
                Console.ReadLine();
            }
        }
        /// <summary>Serialize the instance into the stream</summary>
        public static void Serialize(Stream stream, MessageOptions instance)
        {
            var msField = global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Pop();
            // Key for field: 1, Varint
            stream.WriteByte(8);
            global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBool(stream, instance.MessageSetWireFormat);
            // Key for field: 2, Varint
            stream.WriteByte(16);
            global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBool(stream, instance.NoStandardDescriptorAccessor);
            if (instance.UninterpretedOption != null)
            {
                foreach (var i999 in instance.UninterpretedOption)
                {
                    // Key for field: 999, LengthDelimited
                    stream.WriteByte(186);
                    stream.WriteByte(62);
                    msField.SetLength(0);
                    Google.Protobuf.UninterpretedOption.Serialize(msField, i999);
                    // Length delimited byte array
                    uint length999 = (uint)msField.Length;
                    global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, length999);
                    msField.WriteTo(stream);

                }
            }
            global::SilentOrbit.ProtocolBuffers.ProtocolParser.Stack.Push(msField);
        }
Ejemplo n.º 33
0
 public virtual void SendMessage(string messageName, object param, MessageOptions options)
 {
     MessageSender.SendMessage(this, messageName, param, options);
 }
Ejemplo n.º 34
0
 public static MessageResponse DoSendMessage(MessageOptions data)
 {
     JsonServiceClient client=new JsonServiceClient(ServiceUrl);
        MessageResponse response =client.Send<MessageResponse>(JsonSerializer.SerializeToString(data));
     return response;
 }
Ejemplo n.º 35
0
 /// <summary>Helper: Serialize with a varint length prefix</summary>
 public static void SerializeLengthDelimited(Stream stream, MessageOptions instance)
 {
     var data = SerializeToBytes(instance);
     global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, (uint)data.Length);
     stream.Write(data, 0, data.Length);
 }
Ejemplo n.º 36
0
    //can be called from an other script also to allow start delay
    public void StartMove()
    {
        //if we start the game and no path Container is set, debug a warning and return
        if (pathContainer == null)
        {
            Debug.LogWarning(gameObject.name + " has no path! Please set Path Container.");
            return;
        }

        //get Transform array with waypoint positions
        waypoints = pathContainer.waypoints;

        //check if delay array wasn't set in the editor, then we have to initialize it
        if (StopAtPoint == null)
            StopAtPoint = new float[waypoints.Length];
        else if (StopAtPoint.Length < waypoints.Length)
        {
            //else if the delay array is smaller than the waypoint array,
            //that means we have added waypoints to the path but haven't modified the
            //delay settings, here we need to resize it again while keeping old values
            float[] tempDelay = new float[StopAtPoint.Length];
            Array.Copy(StopAtPoint, tempDelay, StopAtPoint.Length);
            StopAtPoint = new float[waypoints.Length];
            Array.Copy(tempDelay, StopAtPoint, tempDelay.Length);
        }

        //check if message settings list wasn't set in the editor,
        //then we have to initialize it and add/remove an message per waypoint
        if (_messages.Count < waypoints.Length)
        {
            //message count is smaller than waypoint count, add empty message per waypoint
            for (int i = _messages.Count; i < waypoints.Length; i++)
            { MessageOptions opt = new MessageOptions(); opt.message.Add(""); _messages.Add(opt); }
        }
        else if (_messages.Count > waypoints.Length)
        {
            //message count is greater than actual waypoints, remove unnecessary messages
            for (int i = _messages.Count - 1; i >= waypoints.Length; i--)
                _messages.RemoveAt(i);
        }

        //if we should not walk to the first waypoint,
        //we set this gameobject position directly to it and launch the next waypoint routine
        if (!moveToPath)
        {
            //we also add a defined size to our object height,
            //so our gameobject could "stand" on top of the path.
            transform.position = waypoints[currentPoint].position + new Vector3(0, sizeToAdd, 0);
            //we're now at the first waypoint position,
            //so directly call the next waypoint
            StartCoroutine("NextWaypoint");
            return;
        }

        //move to the next waypoint
        Move(currentPoint);
    }
Ejemplo n.º 37
0
 /// <summary>Helper: put the buffer into a MemoryStream and create a new instance to deserializing into</summary>
 public static MessageOptions Deserialize(byte[] buffer)
 {
     MessageOptions instance = new MessageOptions();
     using (var ms = new MemoryStream(buffer))
         Deserialize(ms, instance);
     return instance;
 }
Ejemplo n.º 38
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static MessageOptions DeserializeLengthDelimited(Stream stream)
 {
     MessageOptions instance = new MessageOptions();
     DeserializeLengthDelimited(stream, instance);
     return instance;
 }
Ejemplo n.º 39
0
 private void SetMessageOption(int index, string field, int slot, MessageOptions.ValueType value)
 {
     m_List.GetArrayElementAtIndex(index).FindPropertyRelative(field).GetArrayElementAtIndex(slot).enumValueIndex = (int)value;
 }
 /// <summary>
 /// Sends a message. A message is a runtime checked method call.
 /// </summary>
 /// <param name="toSendTo">The object to send the message to.</param>
 /// <param name="methodName">The name of the method accepting the message.</param>
 /// <param name="parameter">Data sent with the message.</param>
 /// <param name="opt">Specifies if the receiving object required to have a method capable of handling the message.</param>
 public static void SendMessage(object toSendTo, string methodName, object parameter, MessageOptions opt)
 {
     MessageCollection delegateDict;
     if(messages.TryGetValue(toSendTo.GetType(), out delegateDict))
     {
         Action<object,object> _del;
         if (delegateDict.TryGetValue(methodName, out _del))
             _del.Invoke(toSendTo, parameter);
         else if (opt == MessageOptions.DontRequireReceiver)
             return;
         else
           throw new MessageException("The message {0} does not exist in the type {1}", methodName, toSendTo.GetType());
     } else
        throw new MessageException("The type {0} has not been registered with the MessageSender.");
 }
Ejemplo n.º 41
0
    //can be called from an other script also to allow start delay
    public void StartMove()
    {
        //if we start the game and no path Container is set, debug a warning and return
        if (pathContainer == null)
        {
            Debug.LogWarning(gameObject.name + " has no path! Please set Path Container.");
            return;
        }

        //get Transform array with waypoint positions
        waypoints = pathContainer.waypoints;

        //check if delay array wasn't set in the editor, then we have to initialize it
        if (StopAtPoint == null)
            StopAtPoint = new float[waypoints.Length];
        else if (StopAtPoint.Length < waypoints.Length)
        {
            //else if the delay array is smaller than the waypoint array,
            //that means we have added waypoints to the path but haven't modified the
            //delay settings, here we need to resize it again while keeping old values
            float[] tempDelay = new float[StopAtPoint.Length];
            Array.Copy(StopAtPoint, tempDelay, StopAtPoint.Length);
            StopAtPoint = new float[waypoints.Length];
            Array.Copy(tempDelay, StopAtPoint, tempDelay.Length);
        }

        //check if message settings list wasn't set in the editor,
        //then we have to initialize it and add/remove an message per waypoint
        if (_messages.Count < waypoints.Length)
        {
            //message count is smaller than waypoint count, add empty message per waypoint
            for (int i = _messages.Count; i < waypoints.Length; i++)
            { MessageOptions opt = new MessageOptions(); opt.message.Add(""); _messages.Add(opt); }
        }
        else if (_messages.Count > waypoints.Length)
        {
            //message count is greater than actual waypoints, remove unnecessary messages
            for (int i = _messages.Count - 1; i >= waypoints.Length; i--)
                _messages.RemoveAt(i);
        }

        //start moving
        StartCoroutine(Move());
    }
Ejemplo n.º 42
0
 /// <summary>
 /// Sends a message using the MessageSender class.
 /// </summary>
 /// <param name="name">Message name.</param>
 /// <param name="parameter">Message data.</param>
 public virtual void SendMessage(string name, object parameter = null, MessageOptions options = MessageOptions.DontRequireReceiver)
 {
     MessageSender.SendMessage(this, name, parameter, options);
 }
 public void SendMessage(string messageName, object param, MessageOptions opt = MessageOptions.DontRequireReceiver)
 {
     MessageSender.SendMessage(this, messageName, param, opt);
 }
Ejemplo n.º 44
0
        public override void OnActionExecuting(HttpActionContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            var options = new MessageOptions()
            {
                SaveAdditionalInfo = SaveAdditionalInfo,
                AddFormVariables = AddFormVariables,
                AddQueryStringVariables = AddQueryStringVariables,
                AddCookies = AddCookies
            };

            ScarfLogging.CurrentContext.CreateMessage(this.MessageClass, this.MessageType, options );
        }
        public void Update(string message, string title, MessageOptions option, MessageIcon icon)
        {
            if (String.IsNullOrWhiteSpace(message))
                throw new ArgumentException("message");
            if (String.IsNullOrWhiteSpace(title))
                throw new ArgumentException("title");
            if (option == MessageOptions.None)
                throw new ArgumentException("option");
            if (icon == MessageIcon.None)
                throw new ArgumentException("icon");

            Title = title;
            Message = message;
            Option = option;
            Result = MessageResult.None;

            switch (icon)
            {
                case MessageIcon.Question:
                    Icon = SystemIcons.Question;
                    break;
                case MessageIcon.Information:
                    Icon = SystemIcons.Information;
                    break;
                case MessageIcon.Warning:
                    Icon = SystemIcons.Warning;
                    break;
                case MessageIcon.Error:
                    Icon = SystemIcons.Error;
                    break;
                default:
                    throw new NotImplementedException(icon.ToString());
            }
        }
Ejemplo n.º 46
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static MessageOptions Deserialize(Stream stream)
 {
     MessageOptions instance = new MessageOptions();
     Deserialize(stream, instance);
     return instance;
 }
Ejemplo n.º 47
0
 public MessageResult Show(string message, string title, MessageOptions option)
 {
     return Show(message, title, MessageIcon.Information, option);
 }
Ejemplo n.º 48
0
 /// <summary>Helper: create a new instance to deserializing into</summary>
 public static MessageOptions DeserializeLength(Stream stream, int length)
 {
     MessageOptions instance = new MessageOptions();
     DeserializeLength(stream, length, instance);
     return instance;
 }
Ejemplo n.º 49
0
 private ISubscriptionFilter GetSubscription(MessageOptions options)
 {
     if (options.MessageType == typeof(SynchronizeWithBrokerCommand) || options.MessageType == typeof(StopSynchWithBrokerCommand))
     {
         List<PeerId> acceptedPeers = new List<PeerId>();
         if(_peerConfiguration.ShadowedPeers != null)
         acceptedPeers = _peerConfiguration.ShadowedPeers.Where(x => x.IsPersistenceProvider).Select(x => x.PeerPeerId).ToList();
         return new SynchronizeWithBrokerFilter(acceptedPeers); // todo: implement dynamic subscriptions
     }
     return options.SubscriptionFilter;
 }
Ejemplo n.º 50
0
        /// <summary>Serialize the instance into the stream</summary>
        public static void Serialize(Stream stream, MessageOptions instance)
        {
            // Key for field: 1, Varint
            stream.WriteByte(8);
            global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBool(stream, instance.MessageSetWireFormat);
            // Key for field: 2, Varint
            stream.WriteByte(16);
            global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteBool(stream, instance.NoStandardDescriptorAccessor);
            if (instance.UninterpretedOption != null)
            {
                foreach (var i999 in instance.UninterpretedOption)
                {
                    // Key for field: 999, LengthDelimited
                    stream.Write(new byte[]{186, 62}, 0, 2);
                    using (var ms999 = new MemoryStream())
                    {
                        Google.protobuf.UninterpretedOption.Serialize(ms999, i999);
                        // Length delimited byte array
                        uint ms999Length = (uint)ms999.Length;
                        global::SilentOrbit.ProtocolBuffers.ProtocolParser.WriteUInt32(stream, ms999Length);
                        stream.Write(ms999.GetBuffer(), 0, (int)ms999Length);
                    }

                }
            }
        }
Ejemplo n.º 51
0
    //we reached the end of the path
    internal void ReachedEnd()
    {
        //reset calculated position used for invoking messages
        positionOnPath = -1;

        //we differ between all looptypes, because each one has a specific property
        switch (looptype)
        {
            //LoopType.none means there will be no repeat,
            //so we just discard the tweener and return
            case LoopType.none:

                tween.Kill();
                tween = null;
                PlayIdle();
                break;

            //in a loop we simply start from the beginning
            case LoopType.loop:

                Stop();
                StartMove();
                break;

            //on LoopType.pingPong, we revert the tween,
            //let it run through (backwards) and then restart from the beginning (forwards)
            //so our object basically moves back and forth
            case LoopType.pingPong:

                //cache old waypoint positions
                Vector3[] cachePos = new Vector3[wpPos.Length];
                System.Array.Copy(wpPos, cachePos, wpPos.Length);
                //invert waypoint positions
                for (int i = 0; i < wpPos.Length; i++)
                {
                    wpPos[i] = cachePos[wpPos.Length - 1 - i];
                }

                //cache old messages and their positions
                MessageOptions[] cacheOpt = new MessageOptions[_messages.Count];
                _messages.CopyTo(cacheOpt);
                //invert messages
                for (int i = 0; i < _messages.Count; i++)
                {
                    _messages[i].pos = 1 - _messages[i].pos;
                    _messages[i] = cacheOpt[cacheOpt.Length - 1 - i];
                }

                //create a new reversed tween
                CreateTween();
                break;
        }
    }
Ejemplo n.º 52
0
 /// <summary>Helper: Serialize into a MemoryStream and return its byte array</summary>
 public static byte[] SerializeToBytes(MessageOptions instance)
 {
     using (var ms = new MemoryStream())
     {
         Serialize(ms, instance);
         return ms.ToArray();
     }
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Shows a message box with options, buttons, and help.
 /// </summary>
 /// <param name="text">Message text.</param>
 /// <param name="caption">Message caption.</param>
 /// <param name="options">Message options.</param>
 /// <param name="buttons">Message buttons. Not supported with <c>Gui*</c> options.</param>
 /// <param name="helpTopic">
 /// <include file='doc.xml' path='doc/HelpTopic/*'/>
 /// It is ignored in GUI and drawn messages.
 /// </param>
 /// <returns>The selected button index, or -1 on cancel, or 0 on drawn message.</returns>
 /// <seealso cref="Message(MessageArgs)"/>
 public int Message(string text, string caption, MessageOptions options, string[] buttons, string helpTopic)
 {
     return Message(new MessageArgs() { Text = text, Caption = caption, Options = options, Buttons = buttons, HelpTopic = helpTopic });
 }
 public MessageBoxViewModel(string message, string title, MessageOptions option, MessageIcon icon)
 {
     Update(message, title, option, icon);
 }
Ejemplo n.º 55
0
    //return message list from iMove.cs
    //we create a new list and fill it with all given values for serialization
    private List<MessageOptions> GetMessageList()
    {
        //create new list for returning
        List<MessageOptions> msgOpt = new List<MessageOptions>();

        //loop through whole list
        for (int i = 0; i < m_List.arraySize; i++)
        {
            //get serialized MessageOption slot
            SerializedProperty slot = m_List.GetArrayElementAtIndex(i);
            //create new MessageOption to store values
            MessageOptions opt = new MessageOptions();
            //store values of serialized MessageOption properties
            SerializedProperty msgList = slot.FindPropertyRelative("message");
            SerializedProperty typeList = slot.FindPropertyRelative("type");
            SerializedProperty objList = slot.FindPropertyRelative("obj");
            SerializedProperty textList = slot.FindPropertyRelative("text");
            SerializedProperty numList = slot.FindPropertyRelative("num");
            SerializedProperty vect2List = slot.FindPropertyRelative("vect2");
            SerializedProperty vect3List = slot.FindPropertyRelative("vect3");

            //loop through values of this MessageOption
            for (int j = 0; j < msgList.arraySize; j++)
            {
                //fill created MessageOption with serialized values
                opt.message.Add(msgList.GetArrayElementAtIndex(j).stringValue);

                //abort if opened at runtime without specification of message settings before
                if (typeList.arraySize != msgList.arraySize)
                {
                    Debug.LogWarning("Resized Message List at runtime! Please open Message Settings in the editor first.");
                    return null;
                }

                opt.type.Add((MessageOptions.ValueType)typeList.GetArrayElementAtIndex(j).enumValueIndex);
                opt.obj.Add(objList.GetArrayElementAtIndex(j).objectReferenceValue);
                opt.text.Add(textList.GetArrayElementAtIndex(j).stringValue);
                opt.num.Add(numList.GetArrayElementAtIndex(j).floatValue);
                opt.vect2.Add(vect2List.GetArrayElementAtIndex(j).vector2Value);
                opt.vect3.Add(vect3List.GetArrayElementAtIndex(j).vector3Value);
            }
            //add filled MessageOption to the list
            msgOpt.Add(opt);
        }
        //return final list of messages
        return msgOpt;
    }
Ejemplo n.º 56
0
 //add new message slot with default values to an existing message option
 internal MessageOptions AddMessageToOption(MessageOptions opt)
 {
     opt.message.Add("");
     opt.type.Add(MessageOptions.ValueType.None);
     opt.obj.Add(null);
     opt.text.Add(null);
     opt.num.Add(0);
     opt.vect2.Add(Vector2.zero);
     opt.vect3.Add(Vector3.zero);
     return opt;
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Shows a message box with options.
 /// </summary>
 /// <param name="text">Message text.</param>
 /// <param name="caption">Message caption.</param>
 /// <param name="options">Message options.</param>
 /// <returns>The selected button index, or -1 on cancel, or 0 on drawn message.</returns>
 /// <seealso cref="Message(MessageArgs)"/>
 public int Message(string text, string caption, MessageOptions options)
 {
     return Message(new MessageArgs() { Text = text, Caption = caption, Options = options });
 }