Example #1
0
        private static void HandleException(object e)
        {
            var message = Resources.ExceptionUnknown;

            var exception = e as Exception;

            if (exception != null)
            {
                var temp = exception;
                message = string.IsNullOrEmpty(temp.Message) ? e.ToString() : temp.Message;
            }
            else if (e != null)
                message = string.Format(Resources.NotExceptionFormat, e.GetType());

            using (var dialog = new MessageDialog(MessageType.Error, message))
            {
                dialog.Icon = Resources.RiftIcon; // Taskbar icon fix.

                var result = dialog.ShowDialog();
                restart = result == DialogResult.Retry;
            }
        }
Example #2
0
        private void UpdatePoints(int p)
        {
            panelTop.SuspendLayout();

            if (p < 0)
                using (var dialog = new MessageDialog(MessageType.Warning, Resources.WarningUpdatePointsCount))
                    dialog.ShowDialog(this);
            else
                labelPoints.Text = string.Format("{0}@", p);

            panelTop.ResumeLayout();
            contentWorker.RunWorkerAsync();
        }
Example #3
0
        private void HandleItemOperation(ItemBoughtResult result)
        {
            if ((result & ItemBoughtResult.Failure) == ItemBoughtResult.Failure)
            {
                var temp = new StringBuilder();

                if ((result & ItemBoughtResult.IdMismatch) == ItemBoughtResult.IdMismatch)
                    temp.Append(Resources.ItemBoughtResultId).Append(Environment.NewLine);

                if ((result & ItemBoughtResult.CharacterMismatch) == ItemBoughtResult.CharacterMismatch)
                    temp.Append(Resources.ItemBoughtResultCharacter).Append(Environment.NewLine);

                if ((result & ItemBoughtResult.ServiceUnavailable) == ItemBoughtResult.ServiceUnavailable)
                    temp.Append(Resources.ItemBoughtResultService).Append(Environment.NewLine);

                if ((result & ItemBoughtResult.NotEnoughPoints) == ItemBoughtResult.NotEnoughPoints)
                    temp.Append(Resources.ItemBoughtResultPoints).Append(Environment.NewLine);

                var message = string.Format(Resources.WarningItemBoughtFailureFormat, temp);

                using (var dialog = new MessageDialog(MessageType.Warning, message))
                    dialog.ShowDialog(this);

                return;
            }

            var successMessage = string.Format(Resources.MessageItemBoughtSuccessFormat, characters.Dequeue());

            using (var dialog = new MessageDialog(MessageType.Info, successMessage))
                dialog.ShowDialog(this);

            if (account != null)
                App.CurrentContext.ShopManager.UpdatePointsAsync(account);
        }
Example #4
0
        private void UpdateStatus(ServerStatus status)
        {
            actionButtonPlay.Enabled = status == ServerStatus.Online;

            if (status == ServerStatus.Online) return;

            using (var dialog = new MessageDialog(MessageType.Warning, Resources.WarningConnectionFailed))
                dialog.ShowDialog(this);
        }
Example #5
0
        private bool IsUserInputValid()
        {
            var validationStatus = true;

            if (comboBoxName.SelectedIndex < 0 &&
                (string.IsNullOrEmpty(comboBoxName.Text) || string.IsNullOrEmpty(textBoxPassword.Text)))
            {
                using (var dialog = new MessageDialog(MessageType.Warning, Resources.WarningLoginInfo))
                    dialog.ShowDialog();

                validationStatus = false;
            }
            else
            {
                var account = comboBoxName.SelectedIndex >= 0
                    ? comboBoxName.SelectedItem as GameAccount
                    : new GameAccount(comboBoxName.Text, textBoxPassword.Text);

                if (App.CurrentContext.GameProcessManager.ActiveAccounts.Contains(account))
                {
                    using (var dialog = new MessageDialog(MessageType.Warning, Resources.WarningEntered))
                        dialog.ShowDialog();

                    validationStatus = false;
                }
            }

            if (validationStatus) return true;

            if (string.IsNullOrEmpty(comboBoxName.Text))
                comboBoxName.Focus();
            else if (string.IsNullOrEmpty(textBoxPassword.Text))
                textBoxPassword.Focus();

            return false;
        }