示例#1
0
        public MainPage()
        {
            this.InitializeComponent();

            SetStatus("Initialising ...");

            App.Current.UnhandledException += (s, e) => AddLog(e.Message);

            Background            = Constants.ApplicationBackgroundBrush;
            StatusBar.Background  = Constants.StatusBarBackgroundBrush;
            StatusBar.BorderBrush = Constants.StatusBarBorderBrush;
            ConsoleRow.Height     = new GridLength(0);

            InitialiseKeyboardAccelerators();
            CreateSong();

            Timer          = new System.Timers.Timer(100);
            Timer.Elapsed += (s, e) =>
            {
                while (UpdateBars.Any())
                {
                    UpdateBars.TryDequeue(out UI.Bar bar);
                    UI.Utilities.CallUI(() => bar?.Update());
                }

                if (UpdatePosition)
                {
                    UI.Utilities.CallUI(() => Position.Text = Song.GetTime().ToTimeString());
                    UpdatePosition = false;
                }
            };
            Timer.Start();

            Audio        = new UwpAudio();
            Audio.Ready += (s, e) => OnAudioReady();
        }
示例#2
0
        private async void Save()
        {
            StorageFolder folder = null;

            var folderPicker = new FolderPicker
            {
                SuggestedStartLocation = PickerLocationId.DocumentsLibrary
            };

            folderPicker.FileTypeFilter.Add("*");

            folder = await folderPicker.PickSingleFolderAsync();

            if (folder == null)
            {
                return;
            }

            StoragePath = folder.Name;

            SetStatus("Saving ...");
            UwpAudio.Save(Song, folder, "temp.cmp");
            SetStatus($"Saved to {StoragePath}");
        }