コード例 #1
0
 private void HandleOnResetAudioSettingsButtonSelected(SessionsButton button)
 {
     if (OnCheckIfPlayerIsPlaying())
     {
         using(var alert = new NSAlert())
         {
             alert.MessageText = "Confirmation";
             alert.InformativeText = "Resetting the audio settings will stop the playback.\n\nIf you click OK, the playback will stop and changes will be applied immediately.\n\nIf you click Cancel, the changes will be applied the next time the player is reinitialized.";
             alert.AlertStyle = NSAlertStyle.Warning;
             var btnOK = alert.AddButton("OK");
             btnOK.Activated += (sender2, e2) => {
                 NSApplication.SharedApplication.StopModal();
                 OnResetAudioSettings();
             };
             var btnCancel = alert.AddButton("Cancel");
             btnCancel.Activated += (sender3, e3) => NSApplication.SharedApplication.StopModal();
             alert.RunModal();
         }
     }
 }
コード例 #2
0
 private void HandleOnResetLibraryButtonSelected(SessionsButton button)
 {
     using(var alert = new NSAlert())
     {
         alert.MessageText = "Library will be reset";
         alert.InformativeText = "Are you sure you wish to reset your library? This won't delete any audio files from your hard disk.";
         alert.AlertStyle = NSAlertStyle.Warning;
         var btnOK = alert.AddButton("OK");
         btnOK.Activated += (sender2, e2) => {
             NSApplication.SharedApplication.StopModal();
             OnResetLibrary();
         };
         var btnCancel = alert.AddButton("Cancel");
         btnCancel.Activated += (sender3, e3) => NSApplication.SharedApplication.StopModal();
         alert.RunModal();
     }
 }
コード例 #3
0
 private void HandleOnUpdateLibraryButtonSelected(SessionsButton button)
 {
     OnUpdateLibrary();
 }
コード例 #4
0
        private void HandleOnRemoveFolderButtonSelected(SessionsButton button)
        {
            using(var alert = new NSAlert())
            {
                alert.MessageText = "Folder will be removed from library";
                alert.InformativeText = "Are you sure you wish to remove this folder from your library? This won't delete any audio files from your hard disk.";
                alert.AlertStyle = NSAlertStyle.Warning;
                var btnOK = alert.AddButton("OK");
                btnOK.Activated += (sender2, e2) => {
                    NSApplication.SharedApplication.StopModal();

                    // Remove files from database
                    //OnRemoveFolder(_libraryAppConfig.Folders[tableFolders.SelectedRow]);

                    // Remove folder from list of configured folders
                    _libraryAppConfig.Folders.RemoveAt(tableFolders.SelectedRow);
                    OnSetLibraryPreferences(_libraryAppConfig);
                    tableFolders.ReloadData();
                };
                var btnCancel = alert.AddButton("Cancel");
                btnCancel.Activated += (sender3, e3) => NSApplication.SharedApplication.StopModal();
                alert.RunModal();
            }
        }
コード例 #5
0
        private void HandleOnAddFolderButtonSelected(SessionsButton button)
        {
            string folderPath = string.Empty;
            using(NSOpenPanel openPanel = new NSOpenPanel())
            {
                openPanel.CanChooseDirectories = true;
                openPanel.CanChooseFiles = false;
                openPanel.ReleasedWhenClosed = true;
                openPanel.AllowsMultipleSelection = false;
                openPanel.Title = "Please select a folder to add to the library";
                openPanel.Prompt = "Add folder to library"; 

                // Check for cancel
                if(openPanel.RunModal() == 0)
                    return;

                folderPath = openPanel.Url.Path;
            }

            if (!String.IsNullOrEmpty(folderPath))
                OnAddFolder(folderPath, true);
        }
コード例 #6
0
        private void HandleOnBrowseCustomDirectoryButtonSelected(SessionsButton button)
        {
            string folderPath = string.Empty;
            using(NSOpenPanel openPanel = new NSOpenPanel())
            {
                openPanel.CanChooseDirectories = true;
                openPanel.CanChooseFiles = false;
                openPanel.ReleasedWhenClosed = true;
                openPanel.AllowsMultipleSelection = false;
                openPanel.Title = "Please select a folder for peak files";
                openPanel.Prompt = "Select folder for peak files"; 

                // Check for cancel
                if(openPanel.RunModal() == 0)
                    return;

                folderPath = openPanel.Url.Path;
            }

            if (!String.IsNullOrEmpty(folderPath))
                txtCustomDirectory.StringValue = folderPath;
        }
コード例 #7
0
 private void HandleOnDeletePeakFilesButtonSelected(SessionsButton button)
 {
     using(var alert = new NSAlert())
     {
         alert.MessageText = "Peak files will be deleted";
         alert.InformativeText = "Are you sure you wish to delete the peak files folder? Peak files can always be generated later.";
         alert.AlertStyle = NSAlertStyle.Warning;
         var btnOK = alert.AddButton("OK");
         btnOK.Activated += (sender2, e2) => {
             NSApplication.SharedApplication.StopModal();
             OnDeletePeakFiles();
         };
         var btnCancel = alert.AddButton("Cancel");
         btnCancel.Activated += (sender3, e3) => NSApplication.SharedApplication.StopModal();
         alert.RunModal();
     }
 }
コード例 #8
0
ファイル: SyncWindowController.cs プロジェクト: pascalfr/MPfm
        private void HandleOnAddDeviceButtonSelected(SessionsButton button)
        {
            // Check input url
            string inputUrl = txtAddDeviceUrl.StringValue;
            string baseUrl = inputUrl.ToUpper().StartsWith("HTTP://") ? inputUrl : string.Format("http://{0}", inputUrl);
            if (string.IsNullOrEmpty(inputUrl))
            {
                ShowError(new Exception(string.Format("The url ({0}) is invalid!", inputUrl)));
                return;
            }

            // Check input port
            int port = -1;
            int.TryParse(txtAddDevicePort.StringValue, out port);
            if (port <= 21 || port >= 65536)
            {
                ShowError(new Exception(string.Format("The port value ({0}) is out of range!", port)));
                return;
            }

            string url = string.Format("http://{0}:{1}", baseUrl, port);
            OnAddDeviceFromUrl(url);
        }