Пример #1
0
        public WavePartElement(UPart part) : base()
        {
            partImageTrans = new TranslateTransform();
            this.Part      = part;

            partBitmap = BitmapFactory.New(
                (int)System.Windows.SystemParameters.VirtualScreenWidth,
                (int)UIConstants.TrackMaxHeight);
            partImage = new PartImage()
            {
                RenderTransform = partImageTrans, IsHitTestVisible = false
            };
            partImage.Arrange(new Rect(0, 0, partBitmap.PixelWidth, partBitmap.PixelHeight));
            partImage.Source = partBitmap;
            this.RemoveVisualChild(partVisual);
            this.AddVisualChild(partImage);

            if (((UWavePart)Part).Peaks == null)
            {
                worker = new BackgroundWorker()
                {
                    WorkerReportsProgress = true
                };
                worker.DoWork             += BuildPeaksAsync;
                worker.ProgressChanged    += BuildPeaksProgressChanged;
                worker.RunWorkerCompleted += BuildPeaksCompleted;
                worker.RunWorkerAsync((UWavePart)Part);
            }
        }
Пример #2
0
 public MovePartCommand(UProject project, UPart part, int position, int trackNo) : base(project, part)
 {
     newPos     = position;
     newTrackNo = trackNo;
     oldPos     = part.position;
     oldTrackNo = part.trackNo;
 }
Пример #3
0
        public WavePartElement(UPart part) : base()
        {
            partImageTrans = new TranslateTransform();
            this.Part      = part;

            partBitmap = BitmapFactory.New(
                (int)System.Windows.SystemParameters.VirtualScreenWidth,
                (int)UIConstants.TrackMaxHeight);
            partImage = new PartImage()
            {
                RenderTransform = partImageTrans, IsHitTestVisible = false
            };
            partImage.Arrange(new Rect(0, 0, partBitmap.PixelWidth, partBitmap.PixelHeight));
            partImage.Source = partBitmap;
            this.RemoveVisualChild(partVisual);
            this.AddVisualChild(partImage);

            if (((UWavePart)Part).Peaks == null)
            {
                var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
                Task.Run(() => {
                    ((UWavePart)Part).BuildPeaks(this);
                    Dispatcher.Invoke(() => {
                        RedrawPart();
                    });
                }).ContinueWith((task) => {
                    if (task.IsFaulted)
                    {
                        Log.Information($"{task.Exception}");
                        throw task.Exception;
                    }
                }, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, scheduler);
            }
        }
Пример #4
0
            public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
            {
                UPart result = null;

                if (dictionary.ContainsKey("notes"))
                {
                    result = new UVoicePart();
                    var _result = result as UVoicePart;

                    var notes = dictionary["notes"] as ArrayList;
                    foreach (var note in notes)
                    {
                        _result.Notes.Add(serializer.ConvertToType <UNote>(note));
                    }
                }
                else if (dictionary.ContainsKey("path"))
                {
                    result = Wave.CreatePart(dictionary["path"] as string);
                }

                if (result != null)
                {
                    result.Name    = dictionary["name"] as string;
                    result.Comment = dictionary["comment"] as string;
                    result.TrackNo = Convert.ToInt32(dictionary["trackno"]);
                    result.PosTick = Convert.ToInt32(dictionary["pos"]);
                    result.DurTick = Convert.ToInt32(dictionary["dur"]);
                }

                return(result);
            }
Пример #5
0
 public MovePartCommand(UProject project, UPart part, int newPos, int newTrackNo)
 {
     this.project    = project;
     this.part       = part;
     this.newPos     = newPos;
     this.newTrackNo = newTrackNo;
     this.oldPos     = part.PosTick;
     this.oldTrackNo = part.TrackNo;
 }
Пример #6
0
        public PartResizeEditState(Canvas canvas, MainWindowViewModel vm, UPart part) : base(canvas, vm)
        {
            this.part = part;
            var tracksVm = vm.TracksViewModel;

            if (!tracksVm.SelectedParts.Contains(part))
            {
                tracksVm.DeselectParts();
            }
        }
Пример #7
0
 private void LoadPart(UPart part, UProject project)
 {
     if (!(part is UVoicePart))
     {
         return;
     }
     UnloadPart();
     Part = part as UVoicePart;
     OnPartModified();
 }
Пример #8
0
        private void BuildVoicePartDone(SequencingSampleProvider source, UPart part, UProject project)
        {
            lock (lockObject)
            {
                trackSources[part.TrackNo].AddSource(
                    source,
                    TimeSpan.FromMilliseconds(project.TickToMillisecond(part.PosTick)));
                pendingParts--;
            }

            if (pendingParts == 0)
            {
                StartPlayback();
            }
        }
Пример #9
0
 public ResizePartCommand(UProject project, UPart part, int duration) : base(project, part)
 {
     newDur = duration;
     oldDur = part.Duration;
 }
Пример #10
0
 public ResizePartCommand(UProject project, UPart part, int newDur)
 {
     this.project = project; this.part = part; this.newDur = newDur; this.oldDur = part.DurTick;
 }
Пример #11
0
 public RemovePartCommand(UProject project, UPart part)
 {
     this.project = project; this.part = part;
 }
Пример #12
0
 public PartRefreshEvent(UPart part)
 {
     this.part = part;
 }
Пример #13
0
 public ReplacePartCommand(UProject project, UPart part, UPart newPart) : base(project, part)
 {
     index        = project.parts.IndexOf(part);
     this.newPart = newPart;
 }
Пример #14
0
 public LoadPartNotification(UPart part, UProject project)
 {
     this.part = part; this.project = project;
 }
Пример #15
0
 public RenamePartCommand(UProject project, UPart part, string name) : base(project, part)
 {
     newName = name;
     oldName = part.name;
 }
Пример #16
0
 public FocusNoteNotification(UPart part, UNote note)
 {
     this.part = part;
     this.note = note;
 }
Пример #17
0
 public PartRedrawEvent(UPart part)
 {
     this.part = part;
 }
Пример #18
0
 public RemovePartCommand(UProject project, UPart part) : base(project, part)
 {
 }
Пример #19
0
 public AddPartCommand(UProject project, UPart part) : base(project, part)
 {
 }