Ejemplo n.º 1
0
        void EditStaff(StaffMetadata staff)
        {
            var originalName = staff.Name;

            var staffWindow = new StaffEditorWindow(staff);

            staffWindow.Owner = this;

            var result = staffWindow.ShowDialog();

            if (!result.HasValue || !result.Value)
            {
                return;
            }

            staffWindow.Staff.CopyTo(staff, copyModifiers: false);
            BindingOperations.GetBindingExpression(stavesListBox, ListBox.ItemsSourceProperty).UpdateTarget();

            if (!string.Equals(staff.Name, originalName, StringComparison.Ordinal))
            {
                StaffMetadataManager.Instance.RenameStaff(originalName, staff.Name);
            }

            stavesListBox.SelectedItem = staff;
            stavesListBox.ScrollIntoView(staff);
        }
Ejemplo n.º 2
0
        void AddStaff()
        {
            var staffWindow = new StaffEditorWindow();

            staffWindow.Owner = this;

            var result = staffWindow.ShowDialog();

            if (!result.HasValue || !result.Value)
            {
                return;
            }

            StaffMetadataManager.Instance.AddStaff(staffWindow.Staff);
            stavesListBox.SelectedItem = staffWindow.Staff;
            stavesListBox.ScrollIntoView(staffWindow.Staff);
        }
        void EditStaff(StaffMetadata staff)
        {
            var originalName = staff.Name;

              var staffWindow = new StaffEditorWindow(staff);
              staffWindow.Owner = this;

              var result = staffWindow.ShowDialog();
              if (!result.HasValue || !result.Value)
            return;

              staffWindow.Staff.CopyTo(staff, copyModifiers: false);
              BindingOperations.GetBindingExpression(stavesListBox, ListBox.ItemsSourceProperty).UpdateTarget();

              if (!string.Equals(staff.Name, originalName, StringComparison.Ordinal))
            StaffMetadataManager.Instance.RenameStaff(originalName, staff.Name);

              stavesListBox.SelectedItem = staff;
              stavesListBox.ScrollIntoView(staff);
        }
        void AddStaff()
        {
            var staffWindow = new StaffEditorWindow();
              staffWindow.Owner = this;

              var result = staffWindow.ShowDialog();
              if (!result.HasValue || !result.Value)
            return;

              StaffMetadataManager.Instance.AddStaff(staffWindow.Staff);
              stavesListBox.SelectedItem = staffWindow.Staff;
              stavesListBox.ScrollIntoView(staffWindow.Staff);
        }