コード例 #1
0
        public void Render()
        {
            var renderHelper = new RenderHelper(scorePanel);
            double currentNoteTime = 0;
            double currentDevisions = 0;

            var staffs = new Staffs(renderHelper);

            staffs.Add(new Staff(renderHelper, ScoreLayoutDetails.LineSpacing_Y, ScoreLayoutDetails.Staff1_FristLineY));
            staffs.Add(new Staff(renderHelper, ScoreLayoutDetails.LineSpacing_Y, ScoreLayoutDetails.Staff2_FristLineY));
            staffs.AddBarLine(currentNoteTime);

            foreach (Part part in score.Parts)
                foreach (Measure measure in part.Measures)
                {
                    MeasureAttributes attributes = measure.Attributes;
                    if (attributes != null)
                    {
                        if (attributes.Divisions != -1) currentDevisions = attributes.Divisions;

                        UpdateMeasureAttributes(attributes, staffs, currentNoteTime);
                    }

                    double lastNoteDuration = 0;

                    foreach (Note note in measure.Notes)
                    {
                        //If the current note is part of a chord, we need to revert to the previous NoteTime
                        if (note.IsChord) currentNoteTime -= lastNoteDuration / currentDevisions;

                        Staff staff = GetStaffFromNote(staffs, note);
                        if (staff != null && note.IsDrawableEntity)
                        {
                            staff.AddNote(note, currentDevisions, currentNoteTime);
                        }

                        //After current note drawn, handle keeping track of noteTime in the piece
                        switch (note.NoteType)
                        {
                            case Note.NoteTypes.Backup: currentNoteTime -= note.Duration / currentDevisions;
                                break;
                            case Note.NoteTypes.Forward: currentNoteTime += note.Duration / currentDevisions;
                                break;
                            default: currentNoteTime += note.Duration / currentDevisions;
                                break;
                        }

                        lastNoteDuration = note.Duration;
                    }

                    staffs.AddBarLine(currentNoteTime);
                }

            double finalX = renderHelper.RenderItems(ScoreLayoutDetails.DefaultMargin_X);
            foreach (var staff in staffs) staff.DrawStaffLines(ScoreLayoutDetails.DefaultMargin_X, finalX);
        }
コード例 #2
0
 public static int InsertStaff(Staff staff)
 {
     if (staff.Id == 0)
     {
         staff.Id = GetNewStaffId();
         Staffs.Add(staff);
     }
     return(staff.Id);
 }
コード例 #3
0
        private async Task AddStaffs()
        {
            var viewModel = new StaffDetailViewModel(new StaffTableViewModel(), _staffStore, _pageService);

            viewModel.StaffAdded += (source, staff) =>
            {
                Staffs.Add(new StaffTableViewModel(staff));
            };

            await _pageService.PushModalAsync(new StaffDetailPage(viewModel));
        }
コード例 #4
0
 /// <summary>
 /// Добовление сотрудника
 /// </summary>
 /// <param name="staff">Передать обьект для добовления</param>
 public void AddStaff(Staff staff)
 {
     if (Staffs == null)
     {
         Staffs = new ObservableCollection <Staff>();                     //Если коллекция не создана, создаем ее.
     }
     if (staff is Managers && ThereManager)
     {
         throw new Exception("Уже есть начальник депортамента");
     }
     Staffs.Add(staff);
 }
コード例 #5
0
        public ViewModelFirst(IAdapter adapter, IUserDialogs userDialogs, IApiClient apiClient) : base(adapter)
        {
            OnStartInventoryButtonCommand = new Command(StartInventoryClick);
            OnClearButtonCommand          = new Command(ClearClick);
            OnSaveButtonCommand           = new Command(SaveClick);

            _userDialogs   = userDialogs;
            this.apiClient = apiClient;

            GetDataFromServer();

            InventorySetting();

            Staffs.Add(new Starff()
            {
                Name = "Nam",
                Code = "Nam"
            });
            Staffs.Add(new Starff()
            {
                Name = "Quốc",
                Code = "Quốc"
            });
            Staffs.Add(new Starff()
            {
                Name = "Lan",
                Code = "Lan"
            });
            Staffs.Add(new Starff()
            {
                Name = "Ngọc",
                Code = "Ngọc"
            });

            Customers.Add(new Customer()
            {
                Name = "A.Khoa",
                Code = "A.Khoa"
            });

            Customers.Add(new Customer()
            {
                Name = "C.Cúc",
                Code = "C.Cúc"
            });

            Customers.Add(new Customer()
            {
                Name = "Thương",
                Code = "Thương"
            });
        }
コード例 #6
0
        private async Task LoadData()
        {
            if (_isDataLoaded)
            {
                return;
            }

            _isDataLoaded = true;

            var staff = await _staffStore.GetStaffsAsync();

            foreach (var s in staff)
            {
                Staffs.Add(new StaffTableViewModel(s));
            }
        }
コード例 #7
0
        public Staff(string texture, int originX, int originY, int useTime, float knockBack, string prefix, float shootSpeed = 8f, bool front = false,
                     float manaMultiplier = 1f, int critBonus = 0, int iterations = 1, bool autoSwing = true)
        {
            Type = Staffs.Count + 1;
            if (Main.netMode != NetmodeID.Server)
            {
                Texture = ModLoader.GetMod(Constants.ModName).GetTexture("Content/GFX/Items/Staves/" + texture);
            }
            Origin     = new Vector2(originX, originY);
            UseTime    = useTime;
            KnockBack  = knockBack;
            Iterations = iterations;
            Prefix     = prefix;
            Mana       = manaMultiplier;
            CritBonus  = critBonus;
            AutoSwing  = autoSwing;
            ShootSpeed = shootSpeed;
            Front      = front;

            if (!Staffs.ContainsKey(Type))
            {
                Staffs.Add(Type, this);
            }
        }
コード例 #8
0
 /// <summary>
 /// 新規担当者を追加
 /// </summary>
 /// <param name="staff">担当者情報</param>
 public void AddStaff(Staff staff)
 {
     Staffs.Add(staff);
 }
コード例 #9
0
        public void CreateNewStaff()
        {
            Staff staff = new Staff(defaultRelativeOctave);

            Staffs.Add(staff);
        }