Example #1
0
        /// <summary>
        /// Produces the next generation of individuals in a new field.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void newButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (currSpeakerButton != null)
                {
                    currSpeakerButton.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
                }

                List <byte> selected     = GetSelectedGenomes();
                List <byte> nonPreserved = GetNonPreservedGenomes();
                MainWindow.pop.NextGeneration(individuals, nonPreserved, selected);

                FieldWindow fw = new FieldWindow(MainWindow.pop.Genomes);
                fw.Tag = (int)this.Tag + 1;
                ((Button)fw.fieldGrid.FindName("thisButton")).Name = "thisButton_" + MainWindow.fieldCount + "_" + fw.Tag;

                MdiChild child = new MdiChild();
                child.Name  = MainWindow.fieldIdentifier;
                child.Title = "Field " + MainWindow.fieldCount + "." + fw.Tag;
                MainWindow.mdiChildIdentifier.Add(MainWindow.fieldCount + "_" + fw.Tag);
                child.Width      = double.NaN;
                child.Height     = double.NaN;
                child.Background = Brushes.White;
                child.Content    = fw;
                child.ToolTip    = child.Title;
                windowContainer.Children.Add(child);

                AddFieldWindowGotFocusEventHandler(child);
                AddFieldWindowClosingEventHandler(child);
            }
            catch (Exception)
            {
            }
        }
Example #2
0
        private static void KeySignaturePropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            FieldWindow fieldWindow = source as FieldWindow;
            string      newValue    = e.NewValue as string;

            Parameters.KeySignature = LayoutController.StringToEnum <KeySignature>(newValue + "Maj");
            fieldWindow.ChangeKeySignature(newValue);
        }
Example #3
0
        private static void TempoPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            FieldWindow fieldWindow = source as FieldWindow;
            string      newValue    = e.NewValue as string;

            Parameters.Tempo = Convert.ToByte(newValue);
            fieldWindow.UpdateTempoLabel(newValue);
        }
Example #4
0
        /// <summary>
        /// Starts a new row of bars with the specified key signature.
        /// </summary>
        /// <param name="keySignature"></param>
        private void StartNewRow(string keySign)
        {
            WrapPanel p = new WrapPanel();

            p.Width  = ksPanelWidth;
            p.Height = ScoreStaffs.thisHeight;
            Image keySignature1 = FieldWindow.DrawKeySignature(keySign, Clefs[0], 0);
            Image keySignature2 = FieldWindow.DrawKeySignature(keySign, Clefs[1], 1);

            keySignature1.Margin = new Thickness(0, LayoutController.KeySignatureTopMarginScore[0], 0, 0);
            keySignature2.Margin = new Thickness(0, LayoutController.KeySignatureTopMarginScore[1], 0, 0);
            p.Children.Add(keySignature1);
            p.Children.Add(keySignature2);

            keySignatures.Add(p);
            scoreWrapPanel.Children.Add(p);
        }