示例#1
0
        private void btnPackager_Click(object sender, EventArgs e)
        {
            ImageEffectPreset preset = GetSelectedPreset();

            if (preset != null)
            {
                if (string.IsNullOrEmpty(preset.Name))
                {
                    // TODO: Translate
                    MessageBox.Show("Preset name cannot be empty.", "ShareX - " + "Missing preset name", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string json = eiImageEffects.Serialize(preset);

                    if (!string.IsNullOrEmpty(json))
                    {
                        using (ImageEffectPackagerForm packagerForm = new ImageEffectPackagerForm(json, preset.Name,
                                                                                                  HelpersOptions.ShareXSpecialFolders["ShareXImageEffects"]))
                        {
                            packagerForm.ShowDialog();
                        }
                    }
                }
            }
        }
示例#2
0
        private void btnPackager_Click(object sender, EventArgs e)
        {
            ImageEffectPreset preset = GetSelectedPreset();

            if (preset != null)
            {
                if (string.IsNullOrEmpty(preset.Name))
                {
                    MessageBox.Show(Resources.PresetNameCannotBeEmpty, "ShareX - " + Resources.MissingPresetName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string json = eiImageEffects.Serialize(preset);

                    if (!string.IsNullOrEmpty(json))
                    {
                        using (ImageEffectPackagerForm packagerForm = new ImageEffectPackagerForm(json, preset.Name,
                                                                                                  HelpersOptions.ShareXSpecialFolders["ShareXImageEffects"]))
                        {
                            packagerForm.ShowDialog();
                        }
                    }
                }
            }
        }
示例#3
0
        private void btnPackager_Click(object sender, EventArgs e)
        {
            ImageEffectPreset preset = GetSelectedPreset();

            if (preset != null)
            {
                if (string.IsNullOrEmpty(preset.Name))
                {
                    MessageBox.Show(Resources.PresetNameCannotBeEmpty, "ShareX - " + Resources.MissingPresetName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string json = null;

                    try
                    {
                        json = JsonHelpers.SerializeToString(preset, serializationBinder: serializationBinder);
                    }
                    catch (Exception ex)
                    {
                        DebugHelper.WriteException(ex);
                        ex.ShowError();
                    }

                    if (!string.IsNullOrEmpty(json))
                    {
                        using (ImageEffectPackagerForm packagerForm = new ImageEffectPackagerForm(json, preset.Name,
                                                                                                  HelpersOptions.ShareXSpecialFolders["ShareXImageEffects"]))
                        {
                            packagerForm.ShowDialog();
                        }
                    }
                }
            }
        }