Exemplo n.º 1
0
        public void SetType(UIMessageType type)
        {
            bool showMess   = (type == UIMessageType.IM);
            bool showLetter = (type == UIMessageType.Compose || type == UIMessageType.Read);

            MessageTextEdit.Visible         = showMess;
            MessageScrollDownButton.Visible = showMess;
            MessageScrollUpButton.Visible   = showMess;
            MessageSlider.Visible           = showMess;
            HistoryTextEdit.Visible         = showMess;
            HistorySlider.Visible           = showMess;
            HistoryScrollUpButton.Visible   = showMess;
            HistoryScrollDownButton.Visible = showMess;
            SendMessageButton.Visible       = (type == UIMessageType.IM);

            LetterSubjectTextEdit.Visible  = showLetter;
            LetterTextEdit.Visible         = showLetter;
            LetterSlider.Visible           = showLetter;
            LetterScrollUpButton.Visible   = showLetter;
            LetterScrollDownButton.Visible = showLetter;

            SendLetterButton.Visible    = (type == UIMessageType.Compose);
            RespondLetterButton.Visible = (type == UIMessageType.Read);

            TypeBackground.Texture = (type == UIMessageType.IM) ? backgroundMessageImage : (type == UIMessageType.Read) ? backgroundLetterReadImage : backgroundLetterComposeImage;

            LetterSubjectTextEdit.Mode = (type == UIMessageType.Read) ? UITextEditMode.ReadOnly : UITextEditMode.Editor;
            LetterTextEdit.Mode        = (type == UIMessageType.Read) ? UITextEditMode.ReadOnly : UITextEditMode.Editor;

            if (type == UIMessageType.Compose)
            {
                LetterSubjectTextEdit.CurrentText = "";
                LetterTextEdit.CurrentText        = "";
            }
        }
        public async Task SendMessageAsync(string message, UIMessageType type = UIMessageType.Success)
        {
            switch (type)
            {
            case UIMessageType.Success:
                await _jsRuntime.InvokeVoidAsync("toastr.success", message);

                break;

            case UIMessageType.Error:
                await _jsRuntime.InvokeVoidAsync("toastr.error", message);

                break;

            case UIMessageType.Info:
                await _jsRuntime.InvokeVoidAsync("toastr.info", message);

                break;

            case UIMessageType.Warning:
                await _jsRuntime.InvokeVoidAsync("toastr.warning", message);

                break;
            }
        }
Exemplo n.º 3
0
        public async Task <UIMessageResults> ShowMessageAndWaitForFeedback(
            string title,
            string textContent,
            UIMessageButtons buttons,
            UIMessageType messageType)
        {
            Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Title       = title;
                TextContent = textContent;
                Buttons     = buttons;
                Visibility  = Visibility.Visible;
            });

            _cancelToken = new CancellationTokenSource();
            var ct = _cancelToken.Token;

            try
            {
                await Task.Delay(-1, ct);
            }
            catch (TaskCanceledException)
            {
            }

            Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                Visibility = Visibility.Collapsed;
                Reset();
            });

            Debug.WriteLine("ClickResult: " + ClickResult);
            return(ClickResult);
        }
Exemplo n.º 4
0
 public static void RemoveObserver(UIMessageType _messageType, UIMessageDelegate _handler)
 {
     if (messageDelegates.ContainsKey(_messageType))
     {
         messageDelegates[_messageType] -= _handler;
     }
 }
 /// <summary>
 /// Adds a user interface message to maltego.
 /// </summary>
 /// <param name='messageType'>
 /// Message type.
 /// </param>
 /// <param name='value'>
 /// Value.
 /// </param>
 public void AddUIMessage(UIMessageType messageType, string value)
 {
     MaltegoMessage.MaltegoTransformResponseMessage.UIMessages.Add(new UIMessage {
         MessageType = messageType.ToString(),
         Value       = value
     });
 }
Exemplo n.º 6
0
        public UIMessageIcon(UIMessageType type)
        {
            var script = this.RenderScript("messageicon.uis");

            button             = new UIButton((type == UIMessageType.IM)?BackgroundImageCall:BackgroundImageLetter);
            button.ImageStates = 3;
            this.Add(button);
        }
Exemplo n.º 7
0
 public static void AddObserver(UIMessageType _messageType, UIMessageDelegate _handler)
 {
     if (!messageDelegates.ContainsKey(_messageType))
     {
         messageDelegates.Add(_messageType, null);
     }
     messageDelegates[_messageType] += _handler;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Displays a message.
        /// </summary>
        /// <param name="messageType">The type of message to display.</param>
        /// <param name="view">The view to be used to display the error.</param>
        /// <param name="message">The message to display.</param>
        /// <param name="details">Optional extra details to display.</param>
        protected void DisplayError(UIMessageType messageType, IViewBase view, string message, string details)
        {
            if (view == null)
            {
                throw new ArgumentNullException("view");
            }

            view.DisplayMessage(messageType, this.ErrorTitle, message, details);
        }
Exemplo n.º 9
0
        /////// <summary>
        /////// Reads the path to where Visual Studio is installed.
        /////// </summary>
        /////// <returns>The path to where Visual Studio is installed.</returns>
        /////// <remarks>
        /////// The location is cached so that there is no need to read the registry each time.
        /////// </remarks>
        ////public static string ReadVisualStudioPath()
        ////{
        ////    if (string.IsNullOrEmpty(visualStudioPath))
        ////    {
        ////        using (RegistryKey baseKey32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32))
        ////        {
        ////            using (RegistryKey key = baseKey32.OpenSubKey(RegistryKeyForVisualStudioLocation))
        ////            {
        ////                visualStudioPath = key.GetValue(RegistryValueForVisualStudioLocation) as string;
        ////            }
        ////        }
        ////    }

        ////    return visualStudioPath;
        ////}

        /// <summary>
        /// Shows an error dialog.
        /// </summary>
        /// <param name="messageType">The type of message to display.</param>
        /// <param name="title">The title to be given to the message box.</param>
        /// <param name="message">The message to display.</param>
        /// <param name="details">Optional details to display.</param>
        public static void DisplayMessage(UIMessageType messageType, string title, string message, string details)
        {
            using (MessageDialogue errorDialogue = new MessageDialogue())
            {
                errorDialogue.DisplayMessage(messageType, title, message, details);
                errorDialogue.ShowDialog();
            }
            ////RightToLeftAwareMessageBox.Show(null, message, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
Exemplo n.º 10
0
 public static void NotifyUI <T>(UIMessageType _messageType, T _value)
 {
     if (messageDelegates.ContainsKey(_messageType))
     {
         if (messageDelegates[_messageType] != null)
         {
             ((UIMessageDelegate <T>)messageDelegates[_messageType])(_value);
         }
     }
 }
Exemplo n.º 11
0
 public static void NotifyUI(UIMessageType _messageType, int _value)
 {
     if (messageDelegates.ContainsKey(_messageType))
     {
         if (messageDelegates[_messageType] != null)
         {
             messageDelegates[_messageType](_value);
         }
     }
 }
Exemplo n.º 12
0
    public void SendUIMessage(UIMessageType _messageType)
    {
        UIMessageObject messageObj = new UIMessageObject(_messageType);

        foreach (UIMessageBase ui in listMessageUI)
        {
            if (ui != null)
                ui.ProcessUIMessage(messageObj);
        }
    }
Exemplo n.º 13
0
        /// <summary>
        /// 发送消息给窗口
        /// </summary>
        /// <param name="name"></param>
        /// <param name="messageType"></param>
        /// <param name="paramList"></param>
        /// <returns></returns>
        public bool SendMessageToWindow(string name, UIMessageType messageType, params object[] paramList)
        {
            Window window = FindWndByName <Window>(name);

            if (window != null)
            {
                return(window.OnMessage(messageType, paramList));
            }

            return(false);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Get the first message group with the specified recipient name and type.
 /// </summary>
 private UIMessageGroup GetMessageGroup(string name, UIMessageType type)
 {
     for (int i = 0; i < MessageWindows.Count; i++)
     {
         var elem = MessageWindows.ElementAt(i);
         if (elem.name == name && elem.type == type)
         {
             return(elem);
         }
     }
     return(null);
 }
Exemplo n.º 15
0
        public async Task <UIMessageResults> ShowMessageAndWaitForFeedback(
            string title,
            string textContent,
            UIMessageButtons buttons,
            UIMessageType messageType)
        {
            if (_control == null)
            {
                return(UIMessageResults.OK);
            }

            return(await _control.ShowMessageAndWaitForFeedback(title, textContent, buttons, messageType));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Creates a new UIMessage instance.
        /// </summary>
        /// <param name="type">The type of message (IM, compose or read).</param>
        /// <param name="author">Author if type is read or IM, recipient if type is compose.</param>
        public UIMessage(UIMessageType type, MessageAuthor author)
        {
            var script = this.RenderScript("message.uis");

            Messages = new List <IMEntry>();

            BtnBackground   = new UIImage(backgroundBtnImage);
            BtnBackground.X = 313;
            BtnBackground.Y = 216;
            this.AddAt(0, BtnBackground);

            TypeBackground   = new UIImage(backgroundMessageImage);
            TypeBackground.X = 10;
            TypeBackground.Y = 12;
            this.AddAt(0, TypeBackground);

            Background = new UIImage(backgroundImage);
            this.AddAt(0, Background);

            UIUtils.MakeDraggable(Background, this);
            UIUtils.MakeDraggable(TypeBackground, this);

            LetterSubjectTextEdit.MaxLines   = 1;
            LetterSubjectTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(2, 2, 2, 2);

            MessageSlider.AttachButtons(MessageScrollUpButton, MessageScrollDownButton, 1);
            MessageTextEdit.AttachSlider(MessageSlider);
            MessageTextEdit.OnChange        += new ChangeDelegate(MessageTextEdit_OnChange);
            SendMessageButton.OnButtonClick += new ButtonClickDelegate(SendMessage);
            MessageTextEdit.OnEnterPress    += new KeyPressDelegate(SendMessageEnter);
            SendMessageButton.Disabled       = true;

            LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1);
            LetterTextEdit.AttachSlider(LetterSlider);
            RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick);
            SendLetterButton.OnButtonClick    += new ButtonClickDelegate(SendLetter);

            HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1);
            HistoryTextEdit.AttachSlider(HistorySlider);

            HistoryTextEdit.TextStyle      = HistoryTextEdit.TextStyle.Clone();
            HistoryTextEdit.TextStyle.Size = 8;
            HistoryTextEdit.TextMargin     = new Microsoft.Xna.Framework.Rectangle(3, 3, 3, 3);
            HistoryTextEdit.SetSize(333, 100);

            CloseButton.OnButtonClick += new ButtonClickDelegate(CloseButton_OnButtonClick);

            SetType(type);
            SetMessageAuthor(author);
        }
Exemplo n.º 17
0
        public UIMessage(UIMessageType type, string author)
        {
            var script = this.RenderScript("message.uis");

            Messages = new List<IMEntry>();

            BtnBackground = new UIImage(backgroundBtnImage);
            BtnBackground.X = 313;
            BtnBackground.Y = 216;
            this.AddAt(0, BtnBackground);

            TypeBackground = new UIImage(backgroundMessageImage);
            TypeBackground.X = 10;
            TypeBackground.Y = 12;
            this.AddAt(0, TypeBackground);

            Background = new UIImage(backgroundImage);
            this.AddAt(0, Background);

            UIUtils.MakeDraggable(Background, this);
            UIUtils.MakeDraggable(TypeBackground, this);

            LetterSubjectTextEdit.MaxLines = 1;
            LetterSubjectTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(2, 2, 2, 2);

            MessageSlider.AttachButtons(MessageScrollUpButton, MessageScrollDownButton, 1);
            MessageTextEdit.AttachSlider(MessageSlider);
            MessageTextEdit.OnChange += new ChangeDelegate(MessageTextEdit_OnChange);
            SendMessageButton.OnButtonClick += new ButtonClickDelegate(SendMessage);
            MessageTextEdit.OnEnterPress += new KeyPressDelegate(SendMessageEnter);
            SendMessageButton.Disabled = true;

            LetterSlider.AttachButtons(LetterScrollUpButton, LetterScrollDownButton, 1);
            LetterTextEdit.AttachSlider(LetterSlider);
            RespondLetterButton.OnButtonClick += new ButtonClickDelegate(RespondLetterButton_OnButtonClick);
            SendLetterButton.OnButtonClick += new ButtonClickDelegate(SendLetter);

            HistorySlider.AttachButtons(HistoryScrollUpButton, HistoryScrollDownButton, 1);
            HistoryTextEdit.AttachSlider(HistorySlider);

            HistoryTextEdit.TextStyle = HistoryTextEdit.TextStyle.Clone();
            HistoryTextEdit.TextStyle.Size = 8;
            HistoryTextEdit.TextMargin = new Microsoft.Xna.Framework.Rectangle(3, 3, 3, 3);
            HistoryTextEdit.SetSize(333, 100);

            SetType(type);
            SetMessageAuthor(author);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Sets up the display of a message.
        /// </summary>
        /// <param name="messageType">The type of message to display.</param>
        /// <param name="title">The title to display.</param>
        /// <param name="message">The message to display.</param>
        /// <param name="details">The details to display (optional)</param>
        public void DisplayMessage(UIMessageType messageType, string title, string message, string details)
        {
            Icon icon;

            switch (messageType)
            {
            case UIMessageType.Warning:
            {
                icon = SystemIcons.Warning;
                break;
            }

            case UIMessageType.Error:
            {
                icon = SystemIcons.Error;
                break;
            }

            default:
            {
                icon = SystemIcons.Error;
                break;
            }
            }

            using (Icon errorIcon = new Icon(icon, 32, 32))
            {
                this.pictureBoxIcon.Image = errorIcon.ToBitmap();
            }

            this.Text = title;
            this.textBoxMessage.Text = message;
            if (!string.IsNullOrEmpty(details))
            {
                this.buttonDetails.Visible  = true;
                this.textBoxDetails.Text    = details;
                this.textBoxDetails.Visible = false;
            }
            else
            {
                this.buttonDetails.Visible = false;
            }

            this.buttonDetails.Text = DialogueResources.ShowDetails;
        }
Exemplo n.º 19
0
        public async Task ShowMessage(
            string title,
            string textContent,
            UIMessageButtons buttons,
            UIMessageType messageType,
            int durationMilliseconds)
        {
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                Title = title;
                _contentBuilder.AppendLine(textContent);
                TextContent = _contentBuilder.ToString();

                if (!_isShowing)
                {
                    ShowDurationMilliseconds = durationMilliseconds;
                    Buttons = buttons;

                    _isShowing = true;
                    Visibility = Visibility.Visible;

                    _cancelToken = new CancellationTokenSource();
                    var ct       = _cancelToken.Token;

                    try
                    {
                        await Task.Delay(durationMilliseconds, ct);
                    }
                    catch (TaskCanceledException)
                    {
                    }

                    Visibility = Visibility.Collapsed;
                    _isShowing = false;
                    _contentBuilder.Clear();
                    Reset();
                }
            });
        }
Exemplo n.º 20
0
        public UIMessageGroup(UIMessageType type, MessageAuthor author, UIMessageController parent)
        {
            this.parent = parent;
            this.name   = author.Author;
            this.type   = type;

            window = new UIMessageWindow();
            this.Add(window);
            window.X = GlobalSettings.Default.GraphicsWidth / 2 - 194;
            window.Y = GlobalSettings.Default.GraphicsHeight / 2 - 125;
            //icon = new UIMessageIcon(type);
            //this.Add(icon);

            icon.button.OnButtonClick           += new ButtonClickDelegate(Show);
            window.MinimizeButton.OnButtonClick += new ButtonClickDelegate(Hide);
            window.CloseButton.OnButtonClick    += new ButtonClickDelegate(Close);
            this.AddUpdateHook(new UpdateHookDelegate(ButtonAnim));
            Ticks = 0;
            Alert = false;

            Hide(this);
        }
Exemplo n.º 21
0
		public static Image GetImage(UIMessageType messageType)
		{
			switch (messageType)
			{
				case UIMessageType.Information:
					return Information;
				case UIMessageType.Success:
					return Success;
				case UIMessageType.Question:
					return Question;
				case UIMessageType.Warning:
					return Warning;
				case UIMessageType.Forbidden:
					return Forbidden;
				case UIMessageType.Unauthorized:
					return Unauthorized;
				case UIMessageType.Failure:
					return Failure;

					// Should not happen
				default:
					return Information;
			}
		}
Exemplo n.º 22
0
        public UIMessageGroup(UIMessageType type, MessageAuthor author, UIMessageController parent)
        {
            this.parent = parent;
            this.name = author.Author;
            this.type = type;

            window = new UIMessage(type, author);
            this.Add(window);
            window.X = GlobalSettings.Default.GraphicsWidth / 2 - 194;
            window.Y = GlobalSettings.Default.GraphicsHeight / 2 - 125;
            icon = new UIMessageIcon(type);
            this.Add(icon);

            icon.button.OnButtonClick += new ButtonClickDelegate(Show);
            window.MinimizeButton.OnButtonClick += new ButtonClickDelegate(Hide);
            window.CloseButton.OnButtonClick += new ButtonClickDelegate(Close);
            this.AddUpdateHook(new UpdateHookDelegate(ButtonAnim));
            Ticks = 0;
            Alert = false;

            Hide(this);
        }
Exemplo n.º 23
0
        public void SetType(UIMessageType type)
        {
            bool showMess = (type == UIMessageType.IM);
            bool showLetter = (type == UIMessageType.Compose || type == UIMessageType.Read);

            MessageTextEdit.Visible = showMess;
            MessageScrollDownButton.Visible = showMess;
            MessageScrollUpButton.Visible = showMess;
            MessageSlider.Visible = showMess;
            HistoryTextEdit.Visible = showMess;
            HistorySlider.Visible = showMess;
            HistoryScrollUpButton.Visible = showMess;
            HistoryScrollDownButton.Visible = showMess;
            SendMessageButton.Visible = (type == UIMessageType.IM);

            LetterSubjectTextEdit.Visible = showLetter;
            LetterTextEdit.Visible = showLetter;
            LetterSlider.Visible = showLetter;
            LetterScrollUpButton.Visible = showLetter;
            LetterScrollDownButton.Visible = showLetter;

            SendLetterButton.Visible = (type == UIMessageType.Compose);
            RespondLetterButton.Visible = (type == UIMessageType.Read);

            TypeBackground.Texture = (type == UIMessageType.IM) ? backgroundMessageImage : (type == UIMessageType.Read) ? backgroundLetterReadImage : backgroundLetterComposeImage;

            LetterSubjectTextEdit.Mode = (type == UIMessageType.Read) ? UITextEditMode.ReadOnly : UITextEditMode.Editor;
            LetterTextEdit.Mode = (type == UIMessageType.Read) ? UITextEditMode.ReadOnly : UITextEditMode.Editor;

            if (type == UIMessageType.Compose)
            {
                LetterSubjectTextEdit.CurrentText = "";
                LetterTextEdit.CurrentText = "";
            }

            MessageType = type;
        }
Exemplo n.º 24
0
 public UIMessageObject(UIMessageType _messageType, object _data)
 {
     messageType = _messageType;
     data = _data;
 }
Exemplo n.º 25
0
 public UIMessageObject(UIMessageType _messageType)
 {
     messageType = _messageType;
     data        = new Object();
 }
Exemplo n.º 26
0
 public async void ShowMessage(string title, string content, UIMessageButtons buttons, UIMessageType messageType, int durationMilliseconds = 5000)
 {
     await _control.ShowMessage(title, content, buttons, messageType, durationMilliseconds);
 }
Exemplo n.º 27
0
 public UIMessage(UIMessageType messageType, string message, float time)
 {
     this.messageType = messageType;
     this.message     = message;
     this.time        = time;
 }
Exemplo n.º 28
0
 public virtual bool OnMessage(UIMessageType messageType, params object[] paramList)
 {
     return(true);
 }
Exemplo n.º 29
0
 public UIMessageIcon(UIMessageType type)
 {
     var script = this.RenderScript("messageicon.uis");
     button = new UIButton((type == UIMessageType.IM)?BackgroundImageCall:BackgroundImageLetter);
     button.ImageStates = 3;
     this.Add(button);
 }
 /// <summary>
 /// Get the first message group with the specified recipient name and type.
 /// </summary>
 private UIMessageGroup GetMessageGroup(string name, UIMessageType type)
 {
     for (int i = 0; i < MessageWindows.Count; i++)
     {
         var elem = MessageWindows.ElementAt(i);
         if (elem.name == name && elem.type == type) return elem;
     }
     return null;
 }
 /// <summary>
 /// Displays a message.
 /// </summary>
 /// <param name="messageType">The type of message to display.</param>
 /// <param name="title">The title to be given to the message box.</param>
 /// <param name="message">The message to display.</param>
 /// <param name="details">Optional details to display.</param>
 public void DisplayMessage(UIMessageType messageType, string title, string message, string details)
 {
     Utilities.DisplayMessage(messageType, title, message, details);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UserMessageEventArgs"/> class.
 /// </summary>
 /// <param name="message">The message to be displayed.</param>
 /// <param name="messageType">The type of message to be displayed.</param>
 public UserMessageEventArgs(string message, UIMessageType messageType)
 {
     this.Message     = message;
     this.MessageType = messageType;
 }