private void RemoveShoppingCartItem(object sender, RoutedEventArgs e) { if (null != ShoppingCartListBox.SelectedItem) { PackageBase item = ShoppingCartListBox.SelectedItem as PackageBase; ShoppingCart.Remove(item); ShoppingCartListBox.SelectedIndex = ShoppingCart.Count - 1; } if (0 == ShoppingCart.Count) { RemoveButton.IsEnabled = false; UploadButton.IsEnabled = false; } }
public void CssMediaListApiWithAppendDeleteAndTextShouldWork() { var media = new [] { "handheld", "screen", "only screen and (max-device-width: 480px)" }; var p = new CssParser(); var m = new MediaList(p); Assert.AreEqual(0, m.Length); m.Add(media[0]); m.Add(media[1]); m.Add(media[2]); m.Remove(media[1]); Assert.AreEqual(2, m.Length); Assert.AreEqual(media[0], m[0]); Assert.AreEqual(media[2], m[1]); Assert.AreEqual(String.Concat(media[0], ", ", media[2]), m.MediaText); }
public void CssMediaListApiWithAppendDeleteAndTextShouldWork() { var media = new [] { "handheld", "screen", "only screen and (max-device-width: 480px)" }; var context = BrowsingContext.New(Configuration.Default.WithCss()); var list = new MediaList(context); Assert.AreEqual(0, list.Length); list.Add(media[0]); list.Add(media[1]); list.Add(media[2]); list.Remove(media[1]); Assert.AreEqual(2, list.Length); Assert.AreEqual(media[0], list[0]); Assert.AreEqual(media[2], list[1]); Assert.AreEqual(String.Concat(media[0], ", ", media[2]), list.MediaText); }