예제 #1
0
        private string PromptForEffectName(string originalName)
        {
            SimpleStringPrompt prompt = new SimpleStringPrompt("Enter Effect Name", originalName);
            DialogResult       result = DialogResult.Cancel;
            string             effectLC, effectName = originalName;
            int index;

            while (result != DialogResult.OK)
            {
                result     = prompt.ShowDialog();
                effectName = EffectHelper.CreateSafeEffectName(prompt.Result, false);
                effectLC   = effectName.ToLowerInvariant();
                index      = effectLC.Equals(originalName.ToLowerInvariant()) ? 0 : -1;
                for (int i = 0; i < this.mEffectResources.Length && index < 0; i++)
                {
                    index = EffectHelper.BinarySearchForEffectHandle(effectLC, this.mEffectResources[i]);
                }
                if (index >= 0)
                {
                    MessageBox.Show(effectName + " already exists. Try a different one.", "Alert");
                    result = DialogResult.Cancel;
                }
                if (result == DialogResult.OK)
                {
                    foreach (VisualEffectHandleContainer container in this.outputEffectLST.Items)
                    {
                        if (container.Handle.EffectName.ToLowerInvariant().Equals(effectLC))
                        {
                            MessageBox.Show(effectName + " already exists. Try a different one.", "Alert");
                            result = DialogResult.Cancel;
                            break;
                        }
                    }
                }
            }
            return(effectName);
        }
예제 #2
0
 private string PromptForEffectName(string originalName)
 {
     SimpleStringPrompt prompt = new SimpleStringPrompt("Enter Effect Name", originalName);
     DialogResult result = DialogResult.Cancel;
     string effectLC, effectName = originalName;
     int index;
     while (result != DialogResult.OK)
     {
         result = prompt.ShowDialog();
         effectName = EffectHelper.CreateSafeEffectName(prompt.Result, false);
         effectLC = effectName.ToLowerInvariant();
         index = effectLC.Equals(originalName.ToLowerInvariant()) ? 0 : -1;
         for (int i = 0; i < this.mEffectResources.Length && index < 0; i++)
             index = EffectHelper.BinarySearchForEffectHandle(effectLC, this.mEffectResources[i]);
         if (index >= 0)
         {
             MessageBox.Show(effectName + " already exists. Try a different one.", "Alert");
             result = DialogResult.Cancel;
         }
         if (result == DialogResult.OK)
         {
             foreach (VisualEffectHandleContainer container in this.outputEffectLST.Items)
             {
                 if (container.Handle.EffectName.ToLowerInvariant().Equals(effectLC))
                 {
                     MessageBox.Show(effectName + " already exists. Try a different one.", "Alert");
                     result = DialogResult.Cancel;
                     break;
                 }
             }
         }
     }
     return effectName;
 }