public void SendMailToAdmin(ClientMail clientMail)
        {
            var mailMessage = this._mapper.Map <ClientMail, MailMessage>(clientMail);

            mailMessage.To.Add("*****@*****.**");
            mailMessage.To.Add("*****@*****.**");
            mailMessage.CC.Add(new MailAddress(clientMail.Email));
            mailMessage.CC.Add(new MailAddress("*****@*****.**"));
            this._mailClient.SendEmail(mailMessage);
        }
Example #2
0
        public override void Hide()
        {
            if (!Visible)
            {
                return;
            }
            Visible = false;

            SelectedMail  = null;
            SelectedIndex = -1;
        }
Example #3
0
 public async Task <ActionResult> SendMailMessage(ClientMail mail)
 {
     try
     {
         this._mailSender.SendMailToAdmin(mail);
     }
     catch (Exception)
     {
         return(Redirect(this.Request.UrlReferrer?.AbsoluteUri ?? "/"));
     }
     return(Redirect(Request.UrlReferrer?.AbsoluteUri ?? "/"));
 }
Example #4
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            Mail          = null;
            SenderLabel   = null;
            MessageLabel  = null;
            SelectedImage = null;
            IconImage     = null;

            Selected = false;
        }
        public Task SendMailToAdminAsync(ClientMail clientMail)
        {
            if (string.IsNullOrWhiteSpace(clientMail.Email) ||
                string.IsNullOrWhiteSpace(clientMail.FullName) ||
                string.IsNullOrWhiteSpace(clientMail.Subject) ||
                string.IsNullOrWhiteSpace(clientMail.Message))
            {
                throw new ArgumentException("Mail can't be null or empty.", nameof(clientMail));
            }

            var mailMessage = this._mapper.Map <MailMessage>(clientMail);

            //await this._mailClient.SendMailAsync(mailMessage);
            return(Task.CompletedTask);
        }
Example #6
0
        private void SetupErrorNotification(Exception exception)
        {
            DispatcherTimer dispatcherTimer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromMinutes(1)
            };

            dispatcherTimer.Tick += (s, e) => {
                Logging.ToLog("PageNotification - проверка доступности БД");

                try {
                    DataHandle.Instance.CheckDbAvailable();
                    (s as DispatcherTimer).Stop();
                    PageNotification_PreviewMouseDown(null, null);
                } catch (Exception exc) {
                    Logging.ToLog("PageNotification - " + exc.Message + Environment.NewLine + exc.StackTrace);
                    errorCounter++;

                    if (errorCounter == 2 || (isQueryException.HasValue && isQueryException.Value))
                    {
                        string msg = "Ошибка в работе инфомата:" + Environment.NewLine +
                                     exception.Message + Environment.NewLine + exception.StackTrace;

                        if (exception.InnerException != null)
                        {
                            msg += Environment.NewLine + Environment.NewLine + exception.InnerException.Message +
                                   Environment.NewLine + exception.InnerException.StackTrace;
                        }

                        ClientMail.SendMail("Ошибка в работе инфомата", msg, Properties.Settings.Default.MailSTP);

                        if (isQueryException.HasValue && isQueryException.Value)
                        {
                            dispatcherTimer.Stop();
                        }
                    }
                }
            };

            dispatcherTimer.Start();
        }
Example #7
0
        public void ReadMail(ClientMail mail)
        {
            if (mail == null)
            {
                return;
            }

            Mail = mail;

            if (!Mail.Opened)
            {
                Network.Enqueue(new C.ReadMail {
                    MailID = Mail.MailID
                });
            }

            SenderNameLabel.Text = Mail.SenderName;
            DateSentLabel.Text   = Mail.DateSent.ToString("dd/MM/yy H:mm:ss");
            MessageLabel.Text    = Mail.Message.Replace("\\r\\n", "\r\n");

            Visible = true;
        }
Example #8
0
        public MailListDialog()
        {
            Index    = 670;
            Library  = Libraries.Title;
            Size     = new Size(312, 444);
            Movable  = true;
            Sort     = true;
            Location = new Point((Settings.ScreenWidth - Size.Width) - 150, 5);

            TitleLabel = new MirImageControl
            {
                Index    = 7,
                Library  = Libraries.Title,
                Location = new Point(18, 9),
                Parent   = this
            };

            TitleTypeLabel = new MirLabel
            {
                Text       = "TYPE",
                Parent     = this,
                Font       = new Font(Settings.FontName, Settings.FontSize - 1, FontStyle.Italic),
                DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
                Size       = new Size(37, 19),
                Location   = new Point(8, 34)
            };

            TitleSenderLabel = new MirLabel
            {
                Text       = "SENDER",
                Parent     = this,
                Font       = new Font(Settings.FontName, Settings.FontSize - 1, FontStyle.Italic),
                DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
                Size       = new Size(132, 19),
                Location   = new Point(47, 34)
            };

            TitleMessageLabel = new MirLabel
            {
                Text       = "MESSAGE",
                Parent     = this,
                Font       = new Font(Settings.FontName, Settings.FontSize - 1, FontStyle.Italic),
                DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
                Size       = new Size(122, 19),
                Location   = new Point(181, 34)
            };

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 24, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            HelpButton = new MirButton
            {
                Index        = 257,
                HoverIndex   = 258,
                PressedIndex = 259,
                Library      = Libraries.Prguse2,
                Parent       = this,
                Location     = new Point(Size.Width - 50, 3),
                Sound        = SoundList.ButtonA,
            };
            HelpButton.Click += (o, e) => GameScene.Scene.HelpDialog.DisplayPage("");

            PreviousButton = new MirButton
            {
                Index        = 240,
                HoverIndex   = 241,
                PressedIndex = 242,
                Library      = Libraries.Prguse2,
                Parent       = this,
                Location     = new Point(102, Size.Height - 55),
                Sound        = SoundList.ButtonA,
            };
            PreviousButton.Click += (o, e) =>
            {
                if (CurrentPage <= 1)
                {
                    return;
                }

                SelectedMail = null;

                CurrentPage--;

                StartIndex -= 10;

                UpdateInterface();
            };

            PageLabel = new MirLabel
            {
                Text       = "",
                Parent     = this,
                Location   = new Point(120, Size.Height - 55),
                Size       = new Size(67, 15),
                DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
            };

            NextButton = new MirButton
            {
                Index        = 243,
                HoverIndex   = 244,
                PressedIndex = 245,
                Library      = Libraries.Prguse2,
                Parent       = this,
                Location     = new Point(192, Size.Height - 55),
                Sound        = SoundList.ButtonA,
            };
            NextButton.Click += (o, e) =>
            {
                if (CurrentPage >= PageCount)
                {
                    return;
                }

                SelectedMail = null;

                CurrentPage++;
                StartIndex += 10;

                UpdateInterface();
            };

            #region Action Buttons
            SendButton = new MirButton
            {
                Index        = 563,
                HoverIndex   = 564,
                PressedIndex = 565,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(75, 414),
                Sound        = SoundList.ButtonA,
                Hint         = GameLanguage.Send
            };
            SendButton.Click += (o, e) =>
            {
                MirInputBox inputBox = new MirInputBox(GameLanguage.EnterMailToName);

                inputBox.OKButton.Click += (o1, e1) =>
                {
                    //open letter dialog, pass in name
                    GameScene.Scene.MailComposeLetterDialog.ComposeMail(inputBox.InputTextBox.Text);

                    inputBox.Dispose();
                };

                inputBox.Show();
            };

            ReplyButton = new MirButton
            {
                Index        = 569,
                HoverIndex   = 570,
                PressedIndex = 571,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(102, 414),
                Sound        = SoundList.ButtonA,
                Hint         = GameLanguage.Reply
            };
            ReplyButton.Click += (o, e) =>
            {
                if (SelectedMail == null)
                {
                    return;
                }

                GameScene.Scene.MailComposeLetterDialog.ComposeMail(SelectedMail.SenderName);
            };

            ReadButton = new MirButton
            {
                Index        = 572,
                HoverIndex   = 573,
                PressedIndex = 574,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(129, 414),
                Sound        = SoundList.ButtonA,
                Hint         = GameLanguage.Read
            };
            ReadButton.Click += (o, e) =>
            {
                if (SelectedMail == null)
                {
                    return;
                }

                if (SelectedMail.Gold > 0 || SelectedMail.Items.Count > 0)
                {
                    GameScene.Scene.MailReadParcelDialog.ReadMail(SelectedMail);
                }
                else
                {
                    GameScene.Scene.MailReadLetterDialog.ReadMail(SelectedMail);
                }
            };

            DeleteButton = new MirButton
            {
                Index        = 557,
                HoverIndex   = 558,
                PressedIndex = 559,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(156, 414),
                Sound        = SoundList.ButtonA,
                Hint         = GameLanguage.Delete
            };
            DeleteButton.Click += (o, e) =>
            {
                if (SelectedMail == null || SelectedMail.Locked)
                {
                    return;
                }

                if (SelectedMail.Items.Count > 0 || SelectedMail.Gold > 0)
                {
                    MirMessageBox messageBox = new MirMessageBox("This parcel contains items or gold. Are you sure you want to delete it?", MirMessageBoxButtons.YesNo);

                    messageBox.YesButton.Click += (o1, e1) =>
                    {
                        Network.Enqueue(new C.DeleteMail {
                            MailID = SelectedMail.MailID
                        });
                        SelectedMail = null;
                    };

                    messageBox.Show();
                }
                else
                {
                    Network.Enqueue(new C.DeleteMail {
                        MailID = SelectedMail.MailID
                    });
                    SelectedMail = null;
                }
            };

            BlockListButton = new MirButton
            {
                Index        = 520,
                HoverIndex   = 521,
                PressedIndex = 522,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(183, 414),
                Sound        = SoundList.ButtonA,
                Hint         = GameLanguage.BlockList,
                GrayScale    = true,
                Enabled      = false
            };

            BugReportButton = new MirButton
            {
                Index        = 523,
                HoverIndex   = 524,
                PressedIndex = 525,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(210, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Report Bug",
                GrayScale    = true,
                Enabled      = false
            };
            #endregion
        }
Example #9
0
        public void UpdateInterface()
        {
            Reset();

            PageCount = (int)Math.Ceiling((double)GameScene.User.Mail.Count / 10);
            if (PageCount < 1)
            {
                PageCount = 1;
            }

            PageLabel.Text = string.Format("{0} / {1}", CurrentPage, PageCount);

            for (int i = 0; i < Rows.Length; i++)
            {
                if (i + StartIndex >= GameScene.User.Mail.Count)
                {
                    break;
                }

                if (Rows[i] != null)
                {
                    Rows[i].Dispose();
                }

                Rows[i] = new MailItemRow
                {
                    Mail     = GameScene.User.Mail[i + StartIndex],
                    Location = new Point(10, 55 + i * 33),
                    Parent   = this
                };

                Rows[i].Click += (o, e) =>
                {
                    MailItemRow row = (MailItemRow)o;

                    if (row.Mail != SelectedMail)
                    {
                        SelectedMail  = row.Mail;
                        SelectedIndex = FindSelectedIndex();
                        UpdateRows();
                    }
                    else
                    {
                        if (SelectedMail.Gold > 0 || SelectedMail.Items.Count > 0)
                        {
                            GameScene.Scene.MailReadParcelDialog.ReadMail(SelectedMail);
                        }
                        else
                        {
                            GameScene.Scene.MailReadLetterDialog.ReadMail(SelectedMail);
                        }
                    }
                };

                if (SelectedMail != null)
                {
                    if (SelectedMail.MailID == Rows[i].Mail.MailID)
                    {
                        SelectedMail = Rows[i].Mail;
                    }
                }
            }

            UpdateRows();
        }
Example #10
0
        public void ReadMail(ClientMail mail)
        {
            if (mail == null)
            {
                return;
            }

            Mail = mail;

            if (!Mail.Opened)
            {
                Network.Enqueue(new C.ReadMail {
                    MailID = Mail.MailID
                });
            }

            ResetCells();

            SenderNameLabel.Text = Mail.SenderName;
            DateSentLabel.Text   = Mail.DateSent.ToString("dd/MM/yy H:mm:ss");
            MessageLabel.Text    = Mail.Message.Replace("\\r\\n", "\r\n");
            GoldSendLabel.Text   = Mail.Gold.ToString("###,###,##0");

            if (Mail.Items.Count > 0)
            {
                for (int i = 0; i < Cells.Length; i++)
                {
                    if (i >= Mail.Items.Count)
                    {
                        break;
                    }

                    Cells[i] = new MirItemCell
                    {
                        BorderColour = Color.Lime,
                        Size         = new Size(35, 31),
                        GridType     = MirGridType.Mail,
                        Library      = Libraries.Items,
                        Parent       = this,
                        Location     = new Point(27 + (i * 36), 311),
                        ItemSlot     = i,
                        Item         = Mail.Items[i]
                    };
                }
            }

            if (!Mail.Collected)
            {
                CollectButton.Index        = 683;
                CollectButton.HoverIndex   = 684;
                CollectButton.PressedIndex = 685;
                CollectButton.Enabled      = false;
            }
            else
            {
                CollectButton.Index        = 680;
                CollectButton.HoverIndex   = 681;
                CollectButton.PressedIndex = 682;
                CollectButton.Enabled      = true;
            }

            Visible = true;
        }
Example #11
0
        public MailReadLetterDialog()
        {
            Index    = 672;
            Library  = Libraries.Title;
            Size     = new Size(236, 300);
            Movable  = true;
            Sort     = true;
            Location = new Point(100, 100);

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 27, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            SenderNameLabel = new MirLabel
            {
                Parent     = this,
                Font       = new Font(Settings.FontName, 8F),
                ForeColour = Color.White,
                Location   = new Point(70, 35),
                Size       = new Size(150, 15),
                NotControl = true,
            };

            DateSentLabel = new MirLabel
            {
                Parent     = this,
                Font       = new Font(Settings.FontName, 8F),
                ForeColour = Color.White,
                Location   = new Point(70, 56),
                Size       = new Size(150, 15),
                NotControl = true,
            };

            MessageLabel = new MirLabel
            {
                ForeColour = Color.White,
                Parent     = this,
                Font       = new Font(Settings.FontName, 8F),
                Location   = new Point(15, 92),
                Size       = new Size(202, 165),
            };

            DeleteButton = new MirButton
            {
                Index        = 540,
                HoverIndex   = 541,
                PressedIndex = 542,
                Parent       = this,
                Library      = Libraries.Title,
                Sound        = SoundList.ButtonA,
                Location     = new Point(12, 265)
            };
            DeleteButton.Click += (o, e) =>
            {
                if (Mail.Locked)
                {
                    return;
                }

                Network.Enqueue(new C.DeleteMail {
                    MailID = Mail.MailID
                });

                Mail = null;

                Hide();
            };

            LockButton = new MirButton
            {
                Index        = 686,
                HoverIndex   = 687,
                PressedIndex = 688,
                Parent       = this,
                Library      = Libraries.Title,
                Sound        = SoundList.ButtonA,
                Location     = new Point(81, 265)
            };
            LockButton.Click += (o, e) =>
            {
                Mail.Locked = !Mail.Locked;

                //GameScene.Scene.MailListDialog.SelectedMail = null;

                Network.Enqueue(new C.LockMail {
                    MailID = Mail.MailID, Lock = Mail.Locked
                });
            };

            CancelButton = new MirButton
            {
                Index        = 193,
                HoverIndex   = 194,
                PressedIndex = 195,
                Parent       = this,
                Library      = Libraries.Title,
                Sound        = SoundList.ButtonA,
                Location     = new Point(154, 265)
            };
            CancelButton.Click += (o, e) => Hide();
        }
Example #12
0
        public void CreateMailLabel(ClientMail mail)
        {
            if (mail == null)
            {
                DisposeMailLabel();
                return;
            }

            if (MailLabel != null && !MailLabel.IsDisposed) return;

            MailLabel = new MirControl
            {
                BackColour = Color.FromArgb(255, 50, 50, 50),
                Border = true,
                BorderColour = Color.Gray,
                DrawControlTexture = true,
                NotControl = true,
                Parent = this,
                Opacity = 0.7F
            };

            MirLabel nameLabel = new MirLabel
            {
                AutoSize = true,
                ForeColour = Color.Yellow,
                Location = new Point(4, 4),
                OutLine = true,
                Parent = MailLabel,
                Text = mail.SenderName
            };

            MailLabel.Size = new Size(Math.Max(MailLabel.Size.Width, nameLabel.DisplayRectangle.Right + 4),
                Math.Max(MailLabel.Size.Height, nameLabel.DisplayRectangle.Bottom));

            MirLabel dateLabel = new MirLabel
            {
                AutoSize = true,
                ForeColour = Color.White,
                Location = new Point(4, MailLabel.DisplayRectangle.Bottom),
                OutLine = true,
                Parent = MailLabel,
                Text = "Date Sent : " + mail.DateSent.ToString("dd/MM/yy H:mm:ss")
            };

            MailLabel.Size = new Size(Math.Max(MailLabel.Size.Width, dateLabel.DisplayRectangle.Right + 4),
                Math.Max(MailLabel.Size.Height, dateLabel.DisplayRectangle.Bottom));

            if (mail.Gold > 0)
            {
                MirLabel goldLabel = new MirLabel
                {
                    AutoSize = true,
                    ForeColour = Color.White,
                    Location = new Point(4, MailLabel.DisplayRectangle.Bottom),
                    OutLine = true,
                    Parent = MailLabel,
                    Text = "Gold: " + mail.Gold
                };

                MailLabel.Size = new Size(Math.Max(MailLabel.Size.Width, goldLabel.DisplayRectangle.Right + 4),
                Math.Max(MailLabel.Size.Height, goldLabel.DisplayRectangle.Bottom));
            }

            MirLabel openedLabel = new MirLabel
            {
                AutoSize = true,
                ForeColour = Color.Red,
                Location = new Point(4, MailLabel.DisplayRectangle.Bottom),
                OutLine = true,
                Parent = MailLabel,
                Text = mail.Opened ? "[Old]" : "[New]"
            };

            MailLabel.Size = new Size(Math.Max(MailLabel.Size.Width, openedLabel.DisplayRectangle.Right + 4),
            Math.Max(MailLabel.Size.Height, openedLabel.DisplayRectangle.Bottom));
        }
Example #13
0
        public MailReadLetterDialog()
        {
            Index = 672;
            Library = Libraries.Title;
            Size = new Size(236, 300);
            Movable = true;
            Sort = true;
            Location = new Point(100, 100);

            CloseButton = new MirButton
            {
                HoverIndex = 361,
                Index = 360,
                Location = new Point(Size.Width - 27, 3),
                Library = Libraries.Prguse2,
                Parent = this,
                PressedIndex = 362,
                Sound = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            SenderNameLabel = new MirLabel
            {
                Parent = this,
                Font = new Font(Settings.FontName, 8F),
                ForeColour = Color.White,
                Location = new Point(70, 35),
                Size = new Size(150, 15),
                NotControl = true,
            };

            DateSentLabel = new MirLabel
            {
                Parent = this,
                Font = new Font(Settings.FontName, 8F),
                ForeColour = Color.White,
                Location = new Point(70, 56),
                Size = new Size(150, 15),
                NotControl = true,
            };

            MessageLabel = new MirLabel
            {
                ForeColour = Color.White,
                Parent = this,
                Font = new Font(Settings.FontName, 8F),
                Location = new Point(15, 92),
                Size = new Size(202, 165),
            };

            DeleteButton = new MirButton
            {
                Index = 540,
                HoverIndex = 541,
                PressedIndex = 542,
                Parent = this,
                Library = Libraries.Title,
                Sound = SoundList.ButtonA,
                Location = new Point(12, 265)
            };
            DeleteButton.Click += (o, e) =>
            {
                if (Mail.Locked) return;

                Network.Enqueue(new C.DeleteMail { MailID = Mail.MailID });

                Mail = null;

                Hide();
            };

            LockButton = new MirButton
            {
                Index = 686,
                HoverIndex = 687,
                PressedIndex = 688,
                Parent = this,
                Library = Libraries.Title,
                Sound = SoundList.ButtonA,
                Location = new Point(81, 265)
            };
            LockButton.Click += (o, e) =>
            {
                Mail.Locked = !Mail.Locked;

                //GameScene.Scene.MailListDialog.SelectedMail = null;

                Network.Enqueue(new C.LockMail { MailID = Mail.MailID, Lock = Mail.Locked });
            };

            CancelButton = new MirButton
            {
                Index = 193,
                HoverIndex = 194,
                PressedIndex = 195,
                Parent = this,
                Library = Libraries.Title,
                Sound = SoundList.ButtonA,
                Location = new Point(154, 265)
            };
            CancelButton.Click += (o, e) => Hide();
        }
Example #14
0
        public MailListDialog()
        {
            Index = 670;
            Library = Libraries.Title;
            Size = new Size(312, 444);
            Movable = true;
            Sort = true;
            Location = new Point((Settings.ScreenWidth - Size.Width) - 150, 5);

            CloseButton = new MirButton
            {
                HoverIndex = 361,
                Index = 360,
                Location = new Point(Size.Width - 27, 3),
                Library = Libraries.Prguse2,
                Parent = this,
                PressedIndex = 362,
                Sound = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            HelpButton = new MirButton
            {
                Index = 257,
                HoverIndex = 258,
                PressedIndex = 259,
                Library = Libraries.Prguse2,
                Parent = this,
                Location = new Point(Size.Width - 50, 3),
                Sound = SoundList.ButtonA,
            };
            HelpButton.Click += (o, e) => GameScene.Scene.HelpDialog.DisplayPage("");

            PreviousButton = new MirButton
            {
                Index = 240,
                HoverIndex = 241,
                PressedIndex = 242,
                Library = Libraries.Prguse2,
                Parent = this,
                Location = new Point(102, Size.Height - 55),
                Sound = SoundList.ButtonA,
            };
            PreviousButton.Click += (o, e) =>
            {
                if (CurrentPage <= 1) return;

                SelectedMail = null;

                CurrentPage--;

                StartIndex -= 10;

                UpdateInterface();
            };

            PageLabel = new MirLabel
            {
                Text = "",
                Parent = this,
                Location = new Point(120, Size.Height - 55),
                Size = new Size(67, 15),
                DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
            };

            NextButton = new MirButton
            {
                Index = 243,
                HoverIndex = 244,
                PressedIndex = 245,
                Library = Libraries.Prguse2,
                Parent = this,
                Location = new Point(192, Size.Height - 55),
                Sound = SoundList.ButtonA,
            };
            NextButton.Click += (o, e) =>
            {
                if (CurrentPage >= PageCount) return;

                SelectedMail = null;

                CurrentPage++;
                StartIndex += 10;

                UpdateInterface();
            };

            #region Action Buttons
            SendButton = new MirButton
            {
                Index = 563,
                HoverIndex = 564,
                PressedIndex = 565,
                Library = Libraries.Prguse,
                Parent = this,
                Location = new Point(75, 414),
                Sound = SoundList.ButtonA,
                Hint = "Send"
            };
            SendButton.Click += (o, e) =>
                {
                    MirInputBox inputBox = new MirInputBox("Please enter the name of the person you would like to mail.");

                    inputBox.OKButton.Click += (o1, e1) =>
                    {
                        //open letter dialog, pass in name
                        GameScene.Scene.MailComposeLetterDialog.ComposeMail(inputBox.InputTextBox.Text);

                        inputBox.Dispose();
                    };

                    inputBox.Show();
                };

            ReplyButton = new MirButton
            {
                Index = 569,
                HoverIndex = 570,
                PressedIndex = 571,
                Library = Libraries.Prguse,
                Parent = this,
                Location = new Point(102, 414),
                Sound = SoundList.ButtonA,
                Hint = "Reply"
            };
            ReplyButton.Click += (o, e) =>
            {
                if (SelectedMail == null) return;

                GameScene.Scene.MailComposeLetterDialog.ComposeMail(SelectedMail.SenderName);
            };

            ReadButton = new MirButton
            {
                Index = 572,
                HoverIndex = 573,
                PressedIndex = 574,
                Library = Libraries.Prguse,
                Parent = this,
                Location = new Point(129, 414),
                Sound = SoundList.ButtonA,
                Hint = "Read"
            };
            ReadButton.Click += (o, e) =>
            {
                if (SelectedMail == null) return;

                if(SelectedMail.Gold > 0 || SelectedMail.Items.Count > 0)
                {
                    GameScene.Scene.MailReadParcelDialog.ReadMail(SelectedMail);
                }
                else
                {
                    GameScene.Scene.MailReadLetterDialog.ReadMail(SelectedMail);
                }
            };

            DeleteButton = new MirButton
            {
                Index = 557,
                HoverIndex = 558,
                PressedIndex = 559,
                Library = Libraries.Prguse,
                Parent = this,
                Location = new Point(156, 414),
                Sound = SoundList.ButtonA,
                Hint = "Delete"
            };
            DeleteButton.Click += (o, e) =>
            {
                if (SelectedMail == null || SelectedMail.Locked) return;

                if (SelectedMail.Items.Count > 0 || SelectedMail.Gold > 0)
                {
                    MirMessageBox messageBox = new MirMessageBox("This parcel contains items or gold. Are you sure you want to delete it?", MirMessageBoxButtons.YesNo);

                    messageBox.YesButton.Click += (o1, e1) =>
                    {
                        Network.Enqueue(new C.DeleteMail { MailID = SelectedMail.MailID });
                        SelectedMail = null;
                    };

                    messageBox.Show();
                }
                else
                {
                    Network.Enqueue(new C.DeleteMail { MailID = SelectedMail.MailID });
                    SelectedMail = null;
                }
            };

            BlockListButton = new MirButton
            {
                Index = 520,
                HoverIndex = 521,
                PressedIndex = 522,
                Library = Libraries.Prguse,
                Parent = this,
                Location = new Point(183, 414),
                Sound = SoundList.ButtonA,
                Hint = "Block List"
            };

            BugReportButton = new MirButton
            {
                Index = 523,
                HoverIndex = 524,
                PressedIndex = 525,
                Library = Libraries.Prguse,
                Parent = this,
                Location = new Point(210, 414),
                Sound = SoundList.ButtonA,
                Hint = "Report Bug"
            };
            #endregion
        }
Example #15
0
        public void Hide()
        {
            if (!Visible) return;
            Visible = false;

            SelectedMail = null;
            SelectedIndex = -1;
        }
Example #16
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            Mail = null;
            SenderLabel = null;
            MessageLabel = null;
            SelectedImage = null;
            IconImage = null;

            Selected = false;
        }
Example #17
0
        public void ReadMail(ClientMail mail)
        {
            if (mail == null) return;

            Mail = mail;

            if (!Mail.Opened)
            {
                Network.Enqueue(new C.ReadMail { MailID = Mail.MailID });
            }

            ResetCells();

            SenderNameLabel.Text = Mail.SenderName;
            DateSentLabel.Text = Mail.DateSent.ToString("dd/MM/yy H:mm:ss");
            MessageLabel.Text = Mail.Message.Replace("\\r\\n", "\r\n");
            GoldSendLabel.Text = Mail.Gold.ToString("###,###,##0");

            if (Mail.Items.Count > 0)
            {
                for (int i = 0; i < Cells.Length; i++)
                {
                    if (i >= Mail.Items.Count) break;

                    Cells[i] = new MirItemCell
                    {
                        BorderColour = Color.Lime,
                        Size = new Size(35, 31),
                        GridType = MirGridType.Mail,
                        Library = Libraries.Items,
                        Parent = this,
                        Location = new Point(27 + (i * 36), 311),
                        ItemSlot = i,
                        Item = Mail.Items[i]
                    };
                }
            }

            if (!Mail.Collected)
            {
                CollectButton.Index = 683;
                CollectButton.HoverIndex = 684;
                CollectButton.PressedIndex = 685;
                CollectButton.Enabled = false;
            }
            else
            {
                CollectButton.Index = 680;
                CollectButton.HoverIndex = 681;
                CollectButton.PressedIndex = 682;
                CollectButton.Enabled = true;
            }

            Visible = true;
        }
Example #18
0
        public void ReadMail(ClientMail mail)
        {
            if (mail == null) return;

            Mail = mail;

            if (!Mail.Opened)
            {
                Network.Enqueue(new C.ReadMail { MailID = Mail.MailID });
            }

            SenderNameLabel.Text = Mail.SenderName;
            DateSentLabel.Text = Mail.DateSent.ToString("dd/MM/yy H:mm:ss");
            MessageLabel.Text = Mail.Message.Replace("\\r\\n", "\r\n");

            Visible = true;
        }
Example #19
0
        public MailListDialog()
        {
            Index    = 670;
            Library  = Libraries.Title;
            Size     = new Size(312, 444);
            Movable  = true;
            Sort     = true;
            Location = new Point((Settings.ScreenWidth - Size.Width) - 150, 5);

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 27, 3),
                Library      = Libraries.Prguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
            };
            CloseButton.Click += (o, e) => Hide();

            HelpButton = new MirButton
            {
                Index        = 257,
                HoverIndex   = 258,
                PressedIndex = 259,
                Library      = Libraries.Prguse2,
                Parent       = this,
                Location     = new Point(Size.Width - 50, 3),
                Sound        = SoundList.ButtonA,
            };
            HelpButton.Click += (o, e) => GameScene.Scene.HelpDialog.DisplayPage("");

            PreviousButton = new MirButton
            {
                Index        = 240,
                HoverIndex   = 241,
                PressedIndex = 242,
                Library      = Libraries.Prguse2,
                Parent       = this,
                Location     = new Point(102, Size.Height - 55),
                Sound        = SoundList.ButtonA,
            };
            PreviousButton.Click += (o, e) =>
            {
                if (CurrentPage <= 1)
                {
                    return;
                }

                SelectedMail = null;

                CurrentPage--;

                StartIndex -= 10;

                UpdateInterface();
            };

            PageLabel = new MirLabel
            {
                Text       = "",
                Parent     = this,
                Location   = new Point(120, Size.Height - 55),
                Size       = new Size(67, 15),
                DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
            };

            NextButton = new MirButton
            {
                Index        = 243,
                HoverIndex   = 244,
                PressedIndex = 245,
                Library      = Libraries.Prguse2,
                Parent       = this,
                Location     = new Point(192, Size.Height - 55),
                Sound        = SoundList.ButtonA,
            };
            NextButton.Click += (o, e) =>
            {
                if (CurrentPage >= PageCount)
                {
                    return;
                }

                SelectedMail = null;

                CurrentPage++;
                StartIndex += 10;

                UpdateInterface();
            };

            #region Action Buttons
            SendButton = new MirButton
            {
                Index        = 563,
                HoverIndex   = 564,
                PressedIndex = 565,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(75, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "发送"
            };
            SendButton.Click += (o, e) =>
            {
                MirInputBox inputBox = new MirInputBox("请输入收件人名字。");

                inputBox.OKButton.Click += (o1, e1) =>
                {
                    //open letter dialog, pass in name
                    GameScene.Scene.MailComposeLetterDialog.ComposeMail(inputBox.InputTextBox.Text);

                    inputBox.Dispose();
                };

                inputBox.Show();
            };

            ReplyButton = new MirButton
            {
                Index        = 569,
                HoverIndex   = 570,
                PressedIndex = 571,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(102, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "回复"
            };
            ReplyButton.Click += (o, e) =>
            {
                if (SelectedMail == null)
                {
                    return;
                }

                GameScene.Scene.MailComposeLetterDialog.ComposeMail(SelectedMail.SenderName);
            };

            ReadButton = new MirButton
            {
                Index        = 572,
                HoverIndex   = 573,
                PressedIndex = 574,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(129, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "阅读"
            };
            ReadButton.Click += (o, e) =>
            {
                if (SelectedMail == null)
                {
                    return;
                }

                if (SelectedMail.Gold > 0 || SelectedMail.Items.Count > 0)
                {
                    GameScene.Scene.MailReadParcelDialog.ReadMail(SelectedMail);
                }
                else
                {
                    GameScene.Scene.MailReadLetterDialog.ReadMail(SelectedMail);
                }
            };

            DeleteButton = new MirButton
            {
                Index        = 557,
                HoverIndex   = 558,
                PressedIndex = 559,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(156, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "删除"
            };
            DeleteButton.Click += (o, e) =>
            {
                if (SelectedMail == null || SelectedMail.Locked)
                {
                    return;
                }

                if (SelectedMail.Items.Count > 0 || SelectedMail.Gold > 0)
                {
                    MirMessageBox messageBox = new MirMessageBox("这个包裹包含物品或金币,你确定要删除吗?", MirMessageBoxButtons.YesNo);

                    messageBox.YesButton.Click += (o1, e1) =>
                    {
                        Network.Enqueue(new C.DeleteMail {
                            MailID = SelectedMail.MailID
                        });
                        SelectedMail = null;
                    };

                    messageBox.Show();
                }
                else
                {
                    Network.Enqueue(new C.DeleteMail {
                        MailID = SelectedMail.MailID
                    });
                    SelectedMail = null;
                }
            };

            BlockListButton = new MirButton
            {
                Index        = 520,
                HoverIndex   = 521,
                PressedIndex = 522,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(183, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "黑名单"
            };

            BugReportButton = new MirButton
            {
                Index        = 523,
                HoverIndex   = 524,
                PressedIndex = 525,
                Library      = Libraries.Prguse,
                Parent       = this,
                Location     = new Point(210, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "BUG反馈"
            };
            #endregion
        }
Example #20
0
        public MailListDialog()
        {
            Index    = 670;
            Library  = Libraries.CustomTitle;
            Size     = new Size(312, 444);
            Movable  = true;
            Sort     = true;
            Location = new Point((Settings.ScreenWidth - Size.Width) - 150, 5);

            CloseButton = new MirButton
            {
                HoverIndex   = 361,
                Index        = 360,
                Location     = new Point(Size.Width - 27, 3),
                Library      = Libraries.CustomPrguse2,
                Parent       = this,
                PressedIndex = 362,
                Sound        = SoundList.ButtonA,
                Hint         = "Exit"
            };
            CloseButton.Click += (o, e) => Hide();

            HelpButton = new MirButton
            {
                Index        = 257,
                HoverIndex   = 258,
                PressedIndex = 259,
                Library      = Libraries.CustomPrguse2,
                Parent       = this,
                Location     = new Point(Size.Width - 50, 3),
                Sound        = SoundList.ButtonA,
            };
            HelpButton.Click += (o, e) => GameScene.Scene.HelpDialog.DisplayPage("");

            PreviousButton = new MirButton
            {
                Index        = 240,
                HoverIndex   = 241,
                PressedIndex = 242,
                Library      = Libraries.CustomPrguse2,
                Parent       = this,
                Location     = new Point(102, Size.Height - 55),
                Sound        = SoundList.ButtonA,
            };
            PreviousButton.Click += (o, e) =>
            {
                if (CurrentPage <= 1)
                {
                    return;
                }

                SelectedMail = null;

                CurrentPage--;

                StartIndex -= 10;

                UpdateInterface();
            };

            PageLabel = new MirLabel
            {
                Text       = "",
                Parent     = this,
                Location   = new Point(120, Size.Height - 55),
                Size       = new Size(67, 15),
                DrawFormat = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter,
            };

            NextButton = new MirButton
            {
                Index        = 243,
                HoverIndex   = 244,
                PressedIndex = 245,
                Library      = Libraries.CustomPrguse2,
                Parent       = this,
                Location     = new Point(192, Size.Height - 55),
                Sound        = SoundList.ButtonA,
            };
            NextButton.Click += (o, e) =>
            {
                if (CurrentPage >= PageCount)
                {
                    return;
                }

                SelectedMail = null;

                CurrentPage++;
                StartIndex += 10;

                UpdateInterface();
            };

            #region Action Buttons
            SendButton = new MirButton
            {
                Index        = 563,
                HoverIndex   = 564,
                PressedIndex = 565,
                Library      = Libraries.CustomPrguse,
                Parent       = this,
                Location     = new Point(75, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Send"
            };
            SendButton.Click += (o, e) =>
            {
                MirInputBox inputBox = new MirInputBox("Please enter the name of the person you would like to mail.");

                inputBox.OKButton.Click += (o1, e1) =>
                {
                    //open letter dialog, pass in name
                    GameScene.Scene.MailComposeLetterDialog.ComposeMail(inputBox.InputTextBox.Text);

                    inputBox.Dispose();
                };

                inputBox.Show();
            };

            ReplyButton = new MirButton
            {
                Index        = 569,
                HoverIndex   = 570,
                PressedIndex = 571,
                Library      = Libraries.CustomPrguse,
                Parent       = this,
                Location     = new Point(102, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Reply"
            };
            ReplyButton.Click += (o, e) =>
            {
                if (SelectedMail == null)
                {
                    return;
                }

                GameScene.Scene.MailComposeLetterDialog.ComposeMail(SelectedMail.SenderName);
            };

            ReadButton = new MirButton
            {
                Index        = 572,
                HoverIndex   = 573,
                PressedIndex = 574,
                Library      = Libraries.CustomPrguse,
                Parent       = this,
                Location     = new Point(129, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Read"
            };
            ReadButton.Click += (o, e) =>
            {
                if (SelectedMail == null)
                {
                    return;
                }

                if (SelectedMail.Gold > 0 || SelectedMail.Items.Count > 0)
                {
                    GameScene.Scene.MailReadParcelDialog.ReadMail(SelectedMail);
                }
                else
                {
                    GameScene.Scene.MailReadLetterDialog.ReadMail(SelectedMail);
                }
            };

            DeleteButton = new MirButton
            {
                Index        = 557,
                HoverIndex   = 558,
                PressedIndex = 559,
                Library      = Libraries.CustomPrguse,
                Parent       = this,
                Location     = new Point(156, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Delete"
            };
            DeleteButton.Click += (o, e) =>
            {
                if (SelectedMail == null || SelectedMail.Locked)
                {
                    return;
                }

                if (SelectedMail.Items.Count > 0 || SelectedMail.Gold > 0)
                {
                    MirMessageBox messageBox = new MirMessageBox("This parcel contains items or gold. Are you sure you want to delete it?", MirMessageBoxButtons.YesNo);

                    messageBox.YesButton.Click += (o1, e1) =>
                    {
                        Network.Enqueue(new C.DeleteMail {
                            MailID = SelectedMail.MailID
                        });
                        SelectedMail = null;
                    };

                    messageBox.Show();
                }
                else
                {
                    Network.Enqueue(new C.DeleteMail {
                        MailID = SelectedMail.MailID
                    });
                    SelectedMail = null;
                }
            };

            DeleteAllButton = new MirButton
            {
                Index        = 557,
                HoverIndex   = 558,
                PressedIndex = 559,
                Library      = Libraries.CustomPrguse,
                Parent       = this,
                Location     = new Point(240, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Delete All"
            };
            DeleteAllButton.Click += (o, e) =>
            {
                for (int i = Rows.Length - 1; i >= 0; i--)
                {
                    if (Rows[i] != null &&
                        Rows[i].Mail != null)
                    {
                        if (Rows[i].Mail.Items.Count > 0 || Rows[i].Mail.Gold > 0)
                        {
                            MirMessageBox messageBox = new MirMessageBox("This parcel contains items or gold. Are you sure you want to delete it?", MirMessageBoxButtons.YesNo);

                            messageBox.YesButton.Click += (o1, e1) =>
                                                          Network.Enqueue(new C.DeleteMail {
                                MailID = Rows[i].Mail.MailID
                            });

                            messageBox.Show();
                        }
                        else
                        {
                            Network.Enqueue(new C.DeleteMail {
                                MailID = Rows[i].Mail.MailID
                            });
                        }
                    }
                }
            };

            BlockListButton = new MirButton
            {
                Index        = 520,
                HoverIndex   = 521,
                PressedIndex = 522,
                Library      = Libraries.CustomPrguse,
                Parent       = this,
                Location     = new Point(183, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Block List"
            };

            BugReportButton = new MirButton
            {
                Index        = 523,
                HoverIndex   = 524,
                PressedIndex = 525,
                Library      = Libraries.CustomPrguse,
                Parent       = this,
                Location     = new Point(210, 414),
                Sound        = SoundList.ButtonA,
                Hint         = "Report Bug"
            };
            BugReportButton.Click += (o, e) => GameScene.Scene.MailComposeLetterDialog.ComposeMail("Icey");
            #endregion
        }
Example #21
0
        public void UpdateInterface()
        {
            Reset();

            PageCount = (int)Math.Ceiling((double)GameScene.User.Mail.Count / 10);
            if (PageCount < 1) PageCount = 1;

            PageLabel.Text = string.Format("{0} / {1}", CurrentPage, PageCount);

            for (int i = 0; i < Rows.Length; i++)
            {
                if (i + StartIndex >= GameScene.User.Mail.Count) break;

                if (Rows[i] != null)
                    Rows[i].Dispose();

                Rows[i] = new MailItemRow
                {
                    Mail = GameScene.User.Mail[i + StartIndex],
                    Location = new Point(10, 55 + i * 33),
                    Parent = this
                };

                Rows[i].Click += (o, e) =>
                {
                    MailItemRow row = (MailItemRow)o;

                    if (row.Mail != SelectedMail)
                    {
                        SelectedMail = row.Mail;
                        SelectedIndex = FindSelectedIndex();
                        UpdateRows();
                    }
                    else
                    {
                        if (SelectedMail.Gold > 0 || SelectedMail.Items.Count > 0)
                        {
                            GameScene.Scene.MailReadParcelDialog.ReadMail(SelectedMail);
                        }
                        else
                        {
                            GameScene.Scene.MailReadLetterDialog.ReadMail(SelectedMail);
                        }
                    }
                };

                if (SelectedMail != null)
                {
                    if(SelectedMail.MailID == Rows[i].Mail.MailID)
                    {
                        SelectedMail = Rows[i].Mail;
                    }
                }
            }

            UpdateRows();
        }
        public void TestMethod1()
        {
            var client = new ClientMail();

            client.RunCommand();
        }