private static void SetupUI()
        {
            display        = new Display();
            display.Ready += Display_Ready;

            // Simple Dispatcher and SynchronizationContext do the same job as in a typical GUI:
            // - SynchronizationContext Keeps async code continuations running on the main (UI) thread
            // - Dispatcher allows other threads to invoke Actions on the main (UI) thread
            SynchronizationContext.SetSynchronizationContext(new ConsoleSynchronizationContext(display));
            Dispatcher.Init(display);

            mainDisplayToggler = new AreaToggler();

            scriptDisplay = new ScriptDisplay(display, debugger, new Bounds(0, 0, Length.Percent(60), -2));
            infoDisplay   = new InfoDisplay(display, new Bounds(Length.Percent(60), 0, Length.Percent(40), -2));
            helpDisplay   = new HelpDisplay(display, new Bounds(0, 0, Length.Percent(100), -2));
            prompt        = new Prompt(display, new Bounds(0, -2, Length.Percent(100), 1));
            errorDisplay  = new ErrorDisplay(display, new Bounds(0, -1, Length.Percent(100), 1));

            mainDisplayToggler
            .Add(scriptDisplay)
            .Add(helpDisplay);

            display.Add(scriptDisplay);
            display.Add(helpDisplay);
            display.Add(infoDisplay);
            display.Add(prompt);
            display.Add(errorDisplay);
        }
Exemple #2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ScriptFilename != null)
         {
             hashCode = hashCode * 59 + ScriptFilename.GetHashCode();
         }
         if (ScriptDisplay != null)
         {
             hashCode = hashCode * 59 + ScriptDisplay.GetHashCode();
         }
         if (ScriptPath != null)
         {
             hashCode = hashCode * 59 + ScriptPath.GetHashCode();
         }
         if (ScriptPlatform != null)
         {
             hashCode = hashCode * 59 + ScriptPlatform.GetHashCode();
         }
         if (Interval != null)
         {
             hashCode = hashCode * 59 + Interval.GetHashCode();
         }
         if (Jmxdomain != null)
         {
             hashCode = hashCode * 59 + Jmxdomain.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemple #3
0
 // View display window
 private void toWindowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (customlistBoxtexts.SelectedIndex != -1)
     {
         ScriptDisplay sd = new ScriptDisplay(localized_texts.PrintToQueryWindow(text_id));
         sd.ShowDialog();
     }
     else
     {
         MessageBox.Show("There are no scripts selected in the list.");
     }
 }
Exemple #4
0
        private void LoadScriptButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog scriptl = new OpenFileDialog();

            scriptl.Title           = "Load script.";
            scriptl.Filter          = "Text Files (*.txt)|*.txt";
            scriptl.CheckPathExists = true;
            scriptl.CheckFileExists = true;

            if (scriptl.ShowDialog(this) == DialogResult.OK)
            {
                ScriptDisplay.LoadFile(scriptl.FileName, RichTextBoxStreamType.UnicodePlainText);
            }
        }
Exemple #5
0
        private void SaveScriptButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog scripts = new SaveFileDialog();

            scripts.Title           = "Save script.";
            scripts.Filter          = "Text Files (*.txt)|*.txt";
            scripts.CheckFileExists = true;
            scripts.CheckPathExists = true;
            scripts.AddExtension    = true;

            if (scripts.ShowDialog(this) == DialogResult.OK)
            {
                ScriptDisplay.SaveFile(scripts.FileName, RichTextBoxStreamType.UnicodePlainText);
            }
        }
Exemple #6
0
        /// <summary>
        /// Returns true if ComAdobeGraniteMonitoringImplScriptConfigImplProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of ComAdobeGraniteMonitoringImplScriptConfigImplProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ComAdobeGraniteMonitoringImplScriptConfigImplProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ScriptFilename == other.ScriptFilename ||
                     ScriptFilename != null &&
                     ScriptFilename.Equals(other.ScriptFilename)
                     ) &&
                 (
                     ScriptDisplay == other.ScriptDisplay ||
                     ScriptDisplay != null &&
                     ScriptDisplay.Equals(other.ScriptDisplay)
                 ) &&
                 (
                     ScriptPath == other.ScriptPath ||
                     ScriptPath != null &&
                     ScriptPath.Equals(other.ScriptPath)
                 ) &&
                 (
                     ScriptPlatform == other.ScriptPlatform ||
                     ScriptPlatform != null &&
                     ScriptPlatform.Equals(other.ScriptPlatform)
                 ) &&
                 (
                     Interval == other.Interval ||
                     Interval != null &&
                     Interval.Equals(other.Interval)
                 ) &&
                 (
                     Jmxdomain == other.Jmxdomain ||
                     Jmxdomain != null &&
                     Jmxdomain.Equals(other.Jmxdomain)
                 ));
        }
Exemple #7
0
 // View display window
 private void toWindowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (customlistBoxtexts.SelectedIndex != -1)
     {
         ScriptDisplay sd = new ScriptDisplay(localized_texts.PrintToQueryWindow(text_id));
         sd.ShowDialog();
     }
     else
         MessageBox.Show("There are no scripts selected in the list.");
 }