Exemplo n.º 1
0
        private async void OnUploadClicked(object sender, EventArgs e)
        {
            Sensitive = false;

            bool success;

            try {
                await _upload(_buttonSelect.Filename, _toggleSlim.Active);

                success = true;
            }
            catch (ErrorAnswerException answerException) {
                Msg.Error(this, Tr._("Failed to upload skin!"), answerException.Message);
                success = false;
            }
            catch {
                Msg.Error(this, Tr._("Failed to upload skin!"));
                success = false;
            }

            Sensitive = true;

            if (!success)
            {
                return;
            }

            Hide();
            Destroy();
        }
Exemplo n.º 2
0
        public static void Error(Window parent, string message, string details = null)
        {
            var dialog = new MessageDialog(parent, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, message)
            {
                Title         = Tr._("Error"),
                SecondaryText = details
            };

            dialog.Run();
            dialog.Destroy();
        }
Exemplo n.º 3
0
        private void OnSaveClicked(object sender, EventArgs e)
        {
            var index = _comboPrefixes.Active;

            if (index < 0 || index >= _prefixes.Length)
            {
                Msg.Error(this, Tr._("Incorrect profile version!"));
                return;
            }

            var profileId   = _entryName.Text;
            var profileData = new ProfileData {
                FullVersion       = new FullVersionId(_prefixes[index].Id, _comboVersions.ActiveText),
                CheckVersionFiles = _toggleCheckVersion.Active,
                UseCustomJavaPath = _toggleJavaPath.Active,
                CustomJavaPath    = _buttonJavaPath.Filename,
                UseCustomJavaArgs = _toggleJavaArgs.Active,
                CustomJavaArgs    = _entryJavaArgs.Text
            };

            _buttonSave.Sensitive = false;

            var success = false;

            try {
                _doSave(profileId, profileData);
                success = true;
            }
            catch (InvalidProfileNameException) {
                Msg.Error(this, Tr._("Incorrect profile name!"));
            }
            catch (InvalidProfileVersionException) {
                Msg.Error(this, Tr._("Incorrect game version!"));
            }
            catch {
                Msg.Error(this, Tr._("Failed to save profile! See details in the log."));
            }

            _buttonSave.Sensitive = true;

            if (success)
            {
                Hide();
                Destroy();
            }
        }