Description of PlaylistAssociationBrowseFolder.
Inheritance: AbstractWizardPage
Exemple #1
0
        public void AddAssociationButton_Click(object sender, EventArgs e)
        {
            Wizard wizard = new Wizard();

            PlaylistAssociationChooseDevicePage devicePage = new PlaylistAssociationChooseDevicePage();
            devicePage.Model = model;
            devicePage.PageTitle = "Choose device";

            wizard.Pages.AddLast(devicePage);

            PlaylistAssociationSettings browsePage = new PlaylistAssociationSettings();
            browsePage.PageTitle = "Choose where music is copied to";

            wizard.Pages.AddLast(browsePage);

            DialogResult result = wizard.StartWizard(this);

            if(result == DialogResult.Cancel)
            {
                return;
            }

            Device selectedDevice = (Device)wizard.DataStore[WizardDataStoreKeys.PLAYLIST_ASSOCIATION_SELECTEDDEVICE];
            String selectedPath = (String)wizard.DataStore[WizardDataStoreKeys.PLAYLIST_ASSOCIATION_SELECTEDPATH];

            Button senderButton = (Button)sender;
            PlaylistAssociationControl playlistAssociationControl = (PlaylistAssociationControl)senderButton.Parent;

            PlaylistAssociation playlistAssociation = new PlaylistAssociation(playlistAssociationControl.PlaylistID, "", selectedPath);
            selectedDevice.Playlists.Add(playlistAssociation);

            l.Debug("Attemting to write device configuration to: " + ApplicationUtils.DEVICES_CONFIG_PATH);
            model.Serialize("devices", typeof(DeviceCollection), ApplicationUtils.GetDeviceConfigurationStream(FileMode.Create));
            l.Debug("Device configuration successfully written to: " + ApplicationUtils.DEVICES_CONFIG_PATH);

            DeviceCollection deviceCollection = model.Get<DeviceCollection>("devices");
            UpdateAssociationCountForControl(playlistAssociationControl, deviceCollection);
        }
        void BtnNewClick(object sender, EventArgs e)
        {
            int playlistID = model.Get<int>("editAssociationsPlaylistID");

            Wizard wizard = new Wizard();

            PlaylistAssociationChooseDevicePage devicePage = new PlaylistAssociationChooseDevicePage();
            devicePage.Model = model;
            devicePage.PageTitle = "Choose device";

            wizard.Pages.AddLast(devicePage);

            PlaylistAssociationSettings browsePage = new PlaylistAssociationSettings();
            browsePage.PageTitle = "Choose where music is copied to";
            browsePage.DevicesManager = devicesManager;

            wizard.Pages.AddLast(browsePage);

            DialogResult result = wizard.StartWizard(this);

            if(result == DialogResult.Cancel)
            {
                return;
            }

            Device selectedDevice = (Device)wizard.DataStore[WizardDataStoreKeys.PLAYLIST_ASSOCIATION_SELECTEDDEVICE];
            String selectedPath = (String)wizard.DataStore[WizardDataStoreKeys.PLAYLIST_ASSOCIATION_SELECTEDPATH];

            PlaylistAssociation playlistAssociation = new PlaylistAssociation(playlistID, "", selectedPath);
            selectedDevice.Playlists.Add(playlistAssociation);

            SerializeDeviceConfiguration();

            UpdateAssociatedPlaylists(playlistID);
        }