public void Populate_shouldAddAvailableDevicesToComboBox()
        {
            PlaylistAssociationChooseDevicePage page = new PlaylistAssociationChooseDevicePage();
            page.DataStore = new WizardDataStore();
            page.Model = model;

            page.Populate();

            Assert.AreEqual(devices.Devices.Count, page.SelectedDeviceComboBox.Items.Count);
        }
Beispiel #2
0
 public void Populate_shouldAutoSelectPreviouslySelectedDeviceWhenAvailable()
 {            
     PlaylistAssociationChooseDevicePage page = new PlaylistAssociationChooseDevicePage();
     page.DataStore = new WizardDataStore();
     page.Model = model;
     page.DataStore[WizardDataStoreKeys.PLAYLIST_ASSOCIATION_SELECTEDDEVICE] = device;
     
     page.Populate();
     
     Assert.AreSame(device, page.SelectedDeviceComboBox.SelectedItem);
 }
        public void Populate_shouldAutoSelectPreviouslySelectedDeviceWhenAvailable()
        {
            PlaylistAssociationChooseDevicePage page = new PlaylistAssociationChooseDevicePage();
            page.DataStore = new WizardDataStore();
            page.Model = model;
            page.DataStore[WizardDataStoreKeys.PLAYLIST_ASSOCIATION_SELECTEDDEVICE] = device;

            page.Populate();

            Assert.AreSame(device, page.SelectedDeviceComboBox.SelectedItem);
        }
Beispiel #4
0
 public void Populate_shouldAddAvailableDevicesToComboBox()
 {
     
     PlaylistAssociationChooseDevicePage page = new PlaylistAssociationChooseDevicePage();
     page.DataStore = new WizardDataStore();
     page.Model = model;
     
     page.Populate();
     
     Assert.AreEqual(devices.Devices.Count, page.SelectedDeviceComboBox.Items.Count);
     
 }
Beispiel #5
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);

            PlaylistAssociationBrowseFolder browsePage = new PlaylistAssociationBrowseFolder();
            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);
        }