private void SetMessageUrgencyModel()
        {
            MessageUrgency.Clear();

            Color  color;
            Color  backgroundColor;
            String title;
            String label;
            String imageSourceId;

            ContextMenuItemModel messageUrgencyModelItem;

            String urgencyType;

            urgencyType = UrgencyType.High.ToString();
            Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
            messageUrgencyModelItem = new ContextMenuItemModel()
            {
                Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
            };
            MessageUrgency.Add(messageUrgencyModelItem);

            urgencyType = UrgencyType.Middle.ToString();
            Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
            messageUrgencyModelItem = new ContextMenuItemModel()
            {
                Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
            };
            MessageUrgency.Add(messageUrgencyModelItem);

            urgencyType = UrgencyType.Low.ToString();
            Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
            messageUrgencyModelItem = new ContextMenuItemModel()
            {
                Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
            };
            MessageUrgency.Add(messageUrgencyModelItem);

            urgencyType = UrgencyType.Std.ToString();
            Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
            messageUrgencyModelItem = new ContextMenuItemModel()
            {
                Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
            };
            MessageUrgency.Add(messageUrgencyModelItem);
        }
        private void AddPopupButtonCommand(object obj)
        {
            if (!newPopupAdded)
            {
                if (dynamicContextMenuCounter % 3 == 2)
                {
                    contextMenuModel = new ContextMenuModel();
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "firstname", Title = Helper.SdkWrapper.GetLabel("firstnameOrder")
                    });
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "lastname", Title = Helper.SdkWrapper.GetLabel("lastnameOrder")
                    });
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "company", Title = Helper.SdkWrapper.GetLabel("companyOrder")
                    });

                    dynamicContextMenu = new Controls.ContextMenu {
                        AutomationId = "DynamicContextMenu", WidthRequest = 140
                    };
                    dynamicContextMenu.BindingContext = contextMenuModel;
                }
                else if (dynamicContextMenuCounter % 3 == 1)
                {
                    Color  color;
                    String colorHex;
                    String imageSourceId;

                    contextMenuModel = new ContextMenuModel();

                    color    = Helper.GetResourceDictionaryById <Color>("ColorConversationStreamMessageOtherUserFont");
                    colorHex = color.ToHex();

                    imageSourceId = "Font_PencilAlt|" + colorHex;
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "edit", ImageSourceId = imageSourceId, Title = Helper.SdkWrapper.GetLabel("edit")
                    });

                    imageSourceId = "Font_FileDownload|" + colorHex;
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "download", ImageSourceId = imageSourceId, Title = Helper.SdkWrapper.GetLabel("download")
                    });

                    imageSourceId = "Font_Reply|" + colorHex;
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "reply", ImageSourceId = imageSourceId, Title = Helper.SdkWrapper.GetLabel("replyToMessage")
                    });

                    imageSourceId = "Font_ArrowRight|" + colorHex;
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "forward", ImageSourceId = imageSourceId, Title = Helper.SdkWrapper.GetLabel("forwardMessage")
                    });

                    imageSourceId = "Font_Copy|" + colorHex;
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "copy", ImageSourceId = imageSourceId, Title = Helper.SdkWrapper.GetLabel("copy")
                    });

                    imageSourceId = "Font_TrashAlt|" + colorHex;
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "delete", ImageSourceId = imageSourceId, Title = Helper.SdkWrapper.GetLabel("delete")
                    });

                    imageSourceId = "Font_CloudDownloadAlt|" + colorHex;
                    contextMenuModel.Add(new ContextMenuItemModel()
                    {
                        Id = "save", ImageSourceId = imageSourceId, Title = Helper.SdkWrapper.GetLabel("save")
                    });

                    dynamicContextMenu = new Controls.ContextMenu {
                        AutomationId = "DynamicContextMenu", WidthRequest = 180, StoreSelection = false
                    };
                    dynamicContextMenu.BindingContext = contextMenuModel;
                }
                else if (dynamicContextMenuCounter % 3 == 0)
                {
                    Color  color;
                    Color  backgroundColor;
                    String title;
                    String label;
                    String imageSourceId;

                    ContextMenuItemModel messageUrgencyModelItem;

                    String urgencyType;

                    contextMenuModel = new ContextMenuModel();

                    urgencyType = UrgencyType.High.ToString();
                    Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
                    messageUrgencyModelItem = new ContextMenuItemModel()
                    {
                        Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
                    };
                    contextMenuModel.Add(messageUrgencyModelItem);

                    urgencyType = UrgencyType.Middle.ToString();
                    Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
                    messageUrgencyModelItem = new ContextMenuItemModel()
                    {
                        Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
                    };
                    contextMenuModel.Add(messageUrgencyModelItem);

                    urgencyType = UrgencyType.Low.ToString();
                    Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
                    messageUrgencyModelItem = new ContextMenuItemModel()
                    {
                        Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
                    };
                    contextMenuModel.Add(messageUrgencyModelItem);

                    urgencyType = UrgencyType.Std.ToString();
                    Helper.GetUrgencyInfo(urgencyType, out backgroundColor, out color, out title, out label, out imageSourceId);
                    messageUrgencyModelItem = new ContextMenuItemModel()
                    {
                        Id = urgencyType, ImageSourceId = imageSourceId, Title = title, Description = label, TextColor = color
                    };
                    contextMenuModel.Add(messageUrgencyModelItem);

                    dynamicContextMenu = new Controls.ContextMenu {
                        AutomationId = "DynamicContextMenu", WidthRequest = 280
                    };
                    dynamicContextMenu.BindingContext = contextMenuModel;
                }

                // Increase counter
                dynamicContextMenuCounter++;

                if (dynamicContextMenu != null)
                {
                    dynamicContextMenu.Command = ContextMenuCommand;

                    Popup.Add(this, dynamicContextMenu, PopupType.ContextMenu);
                    newPopupAdded = !newPopupAdded;
                }
            }
            else
            {
                Popup.Remove(this, "DynamicContextMenu");
                newPopupAdded = !newPopupAdded;

                dynamicContextMenu = null;
            }

            UpdateLabel();
            DisplayPopupButton.IsEnabled     = newPopupAdded;
            UpdatePopupModelButton.IsEnabled = newPopupAdded;
        }