Exemple #1
0
 public void Add (Macro macroToAdd)
 {
     if (this.List.Count < m_Capacity)
     {
         this.List.Add(macroToAdd);
         MacroUpdatedEvent();
     }
     else
     {
         throw new Exception();
     }
 }
Exemple #2
0
 public void Update (Macro newMacro)
 {
     Macro macro = this.Find(newMacro.Name);
     if (macro != null)
     {
         macro.Buffer = newMacro.Buffer;
         macro.PseudoColor = newMacro.PseudoColor;
         macro.Histogram = newMacro.Histogram;
         macro.Filter = newMacro.Filter;
         MacroUpdatedEvent();
     }
 }
Exemple #3
0
 public void Remove (Macro macroToAdd)
 {
     this.List.Remove(macroToAdd);
     MacroUpdatedEvent();
 }
Exemple #4
0
        private void AddMacro_Click (object sender, RoutedEventArgs e)
        {
            string macroName = MacroNameField.Text;

            MacroNameField.Text = string.Empty;

            Macro macro = m_sysConfig.Profile.UserMacros.Find(macroName);

            if (String.IsNullOrWhiteSpace(macroName))
            {
                MessageBox.Show(L3.Cargo.Common.Resources.PleaseEnterANameForTheMacro);
            }
            else if (m_sysConfig.Profile.UserMacros.IsFull && macro == null)
            {
                MessageBox.Show(L3.Cargo.Common.Resources.MaxNumberOfMacrosHaveBeenMetPleaseReplaceOneOfTheMacros);
            }
            else
            {
                try
                {
                    Macro newMacro = new Macro(macroName, m_History.GetStep());

                    if (macro != null)
                    {
                        m_sysConfig.Profile.UserMacros.Update(newMacro);
                    }
                    else
                    {
                        m_sysConfig.Profile.UserMacros.Add(newMacro);

                        Macro_Toolbar.Items.Add(CreateMacroButton(newMacro));

                        MacroList.Items.Add(newMacro);
                    }
                }
                catch (Exception ex)
                {
                    // threw this while adding the macro why?  TODO: Log this
                    throw ex;
                }
            }

        }
Exemple #5
0
        private Button CreateMacroButton (Macro macro)
        {
            Button button = new Button();
            button.Margin = new Thickness(1);
            button.Padding = new Thickness(0);
            Image image = new Image();
            image.Width = 32;
            image.Height = 32;
            image.Source = new BitmapImage(new Uri(@"/L3.Cargo.Workstation.Plugins.XRayImageBase;component/Resources/Icons/MacroOff.png", UriKind.Relative));
            button.Content = image;            
            button.ToolTip = macro.Name;
            button.Click += new RoutedEventHandler(Macro_button_Click);

            return button;
        }
Exemple #6
0
 public void Remove(Macro macroToAdd)
 {
     this.List.Remove(macroToAdd);
     MacroUpdatedEvent();
 }