Exemplo n.º 1
0
        private void FlushDeviceConfigurationToFile()
        {
            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);
        }
Exemplo n.º 2
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);
        }