private async void GridViewItemItemClick(object sender, ItemClickEventArgs e) { HomeItem item = e.ClickedItem as HomeItem; if (item.StorageFolder != null) { NavigateToExplorer(item); } else { if (_currentVisualState != null && _currentVisualState.Name != null && _currentVisualState.Name.ToString() == "Snapped") { return; } if (item.Path == StringResources.ResourceLoader.GetString("String_NewFolder") && item.Name == StringResources.ResourceLoader.GetString("String_NewFolder")) { // TODO: 添加新快捷方式文件夹 await AddNewFolder(); } else { await ClickedOnUndefinedDiskCItem(item); } } }
private HomeItem AddNewItem(GroupInfoList <HomeItem> itemList, StorageFolder retrievedFolder, string token) { HomeItem item = new HomeItem() { Name = retrievedFolder.Name, Path = retrievedFolder.Path, StorageFolder = retrievedFolder, }; if (item.Name.Contains(":\\")) { item.DefautImage = GetBitMapImageFromLocalSource("Assets/Disk.png"); item.ImageStretch = "None"; item.IfImageChanged = "Collapsed"; } else if (item.Name == "Documents") { item.DefautImage = GetBitMapImageFromLocalSource("Assets/File.png"); item.ImageStretch = "None"; item.IfImageChanged = "Collapsed"; } else { item.DefautImage = GetBitMapImageFromLocalSource("Assets/Folder.png"); item.ImageStretch = "UniformToFill"; } itemList.Add(item); _dicItemToken.Add(item, token); return(item); }
public static Home CreateFrom(HomeItem homeItem) { Home home = new Home { Id = homeItem.Id, CreatedAt = homeItem.CreatedAt, UpdatedAt = homeItem.UpdatedAt, Version = homeItem.Version, OwnerId = homeItem.OwnerId, UserId = homeItem.UserId, HomeId = homeItem.HomeId, HasAccess = homeItem.HasAccess, Name = homeItem.Name, IsPrimary = homeItem.IsPrimary, BackgroundUri = homeItem.BackgroundUri, BackgroundOpacity = homeItem.BackgroundOpacity, BackgroundBlur = homeItem.BackgroundBlur, IsLocationAvailable = homeItem.IsLocationAvailable, Location = homeItem.Location, MenuItems = homeItem.MenuItems, UserName = homeItem.UserName, Deleted = homeItem.Deleted }; return(home); }
public IActionResult Create(HomeItem home) { _context.Homes.Add(home); _context.SaveChanges(); return(CreatedAtRoute("GetHome", new { id = home.Id }, home)); }
private async Task GetSubImage(HomeItem folderItem) { if (folderItem.StorageFolder == null) { return; } var files = (await folderItem.StorageFolder.GetFilesAsync()); if (files != null && files.Count > 0) { if (files.Any(p => p.IsMediaFile())) { var files2 = files.Where(p => p.IsMediaFile() && p.Name != folderItem.SubImageName); if (files2 != null && files2.Count() > 0) { var file = files2.First(); StorageItemThumbnail fileThumbnail = await file.GetThumbnailAsync(ThumbnailMode.SingleItem, 280); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.SetSource(fileThumbnail); folderItem.Image = bitmapImage; folderItem.SubImageName = file.Name; } } } }
public override void HandleNotification(INotification notification) { switch (notification.Name) { case OrderSystemEvent.SendHouseComClient: Order order = notification.Body as Order; if (order != null) { foreach (var item in order.menus) { if (item.iselected != false) { SendNotification(OrderSystemEvent.FindHouse, order, "GetHouse"); return; } } Debug.LogError("您没有选择房间"); } break; case OrderSystemEvent.ReFreshHouseitem: HomeItem homeItem = notification.Body as HomeItem; View.UpdataState(homeItem); break; } }
public void AddHome(HomeItem item) { if (Homes.Count < 5) { Homes.Add(item); } UpdateHome(item); }
private void NavigateToExplorer(HomeItem item) { Singleton <MetroExplorerLocalDataSource> .Instance.NavigatorStorageFolders = new List <StorageFolder> { item.StorageFolder }; Frame.Navigate(typeof(PageExplorer), null); }
public void UpdataState(HomeItem Home) { for (int i = 0; i < this.Homes.Count; i++) { if (this.Homes[Home.id - 1]) { Homes[Home.id - 1].InitHome(Home); return; } } //Homes[Home.id -1].InitHome(Home); }
private void CustomListview_ItemTapped(object sender, ItemTappedEventArgs e) { string source = e.Item.GetType().Name; switch (source) { case "HomeItem": if (e.Item != null) { var vm = BindingContext as HomeViewModel; // ItemClickCommand?.Execute(e.Item); HomeItem homeItem = e.Item as HomeItem; vm.ShowExtraButtton(homeItem); SelectedItem = null; } break; case "TradeItem": if (e.Item != null) { var vm = BindingContext as MyTradeViewModel; // ItemClickCommand?.Execute(e.Item); TradeItem tradeItem = e.Item as TradeItem; vm.ShowExtraButtton(tradeItem); SelectedItem = null; } break; case "BetItem": if (e.Item != null) { try { var vm = BindingContext as NotifyInViewModel; // ItemClickCommand?.Execute(e.Item); BetItem betItem = e.Item as BetItem; vm.ShowExtraButtton(betItem); SelectedItem = null; } catch (Exception) { var vm = BindingContext as NotifyOutViewModel; // ItemClickCommand?.Execute(e.Item); BetItem betItem = e.Item as BetItem; vm.ShowExtraButtton(betItem); SelectedItem = null; } } break; } }
void InitData() { _dataList = new List <HomeItem>(); for (int i = 0; i < Titles.Length; i++) { var item = new HomeItem() { Title = Titles[i], ActivityType = ActivityTypes[i], ImageResource = Images[i] }; _dataList.Add(item); } }
private void ScrollItemIntoViewButton_Click(object sender, RoutedEventArgs e) { var tag = Convert.ToString((ScrollItemIntoViewComboBox.SelectedItem as ComboBoxItem).Tag); switch (tag) { case "Home": HomeItem.StartBringIntoView(); break; case "HasChildItem": HasChildItem.StartBringIntoView(); break; } }
public void UpdateHome(HomeItem item) { Debug.Log(item.state); for (int i = 0; i < Homes.Count; i++) { if (Homes[i].id == item.id) { Homes[i] = item; Homes[i].state = item.state; Homes[i].HomeType = item.HomeType; SendNotification(OrderSystemEvent.ADD_GUEST, Homes[i]); return; } } }
public static async Task <bool> Delete(HomeItem homeItem) { try { await HomeSyncTable.DeleteAsync(homeItem); await SyncTableAsync(); return(true); } catch (Exception e) { Debug.WriteLine("HomeTableController.Delete - Unable to delete table item. Message recieved: " + e.Message); return(false); } }
public async static Task <bool> Create(HomeItem homeItem) { try { await HomeSyncTable.InsertAsync(homeItem); HomeItem = homeItem; await SyncTableAsync(); return(true); } catch (Exception e) { Debug.WriteLine("HomeTableController.Create - Unable to add item to table. Message recieved: " + e.Message); return(false); } }
private async Task ClickedOnUndefinedDiskCItem(HomeItem item) { if (item.Path == "Map" && item.StorageFolder == null) { Frame.Navigate(typeof(PageMap), null); return; } var storageFolder = await GetStorageFolderFromFolderPicker(); if (storageFolder != null && storageFolder.Name == item.Name) { item.Path = storageFolder.Path; item.StorageFolder = storageFolder; StorageApplicationPermissions.FutureAccessList.Add(item.StorageFolder, item.Name); NavigateToExplorer(item); } else if (storageFolder != null) { AddNewFolder2(storageFolder); } }
private async void AddHome() { HomeItem home = new HomeItem { Name = HomeName, UserName = UserName }; if (MobileService.Client.CurrentUser != null) { home.OwnerId = MobileService.Client.CurrentUser.UserId; home.UserId = MobileService.Client.CurrentUser.UserId; } await HomeTable.Create(home); home.HomeId = HomeTable.HomeItem.Id; await HomeTable.Update(home); SelectedHome = Converters.HomeConverter.CreateFrom(HomeTable.HomeItem); GetHomes(); }
public override void Execute(INotification notification) { HomeProxy homeProxy = Facade.RetrieveProxy(HomeProxy.NAME) as HomeProxy; if (notification.Type == "GetHouse") { Order order = notification.Body as Order; foreach (var item in order.menus) { if (item.iselected) { if (homeProxy.GetHouse(item.id) == null) { Debug.LogError("对不起您要住的房间客满"); } else { HomeItem home = homeProxy.GetHouse(item.id); home.state = 1; SendNotification(OrderSystemEvent.ReFreshHouseitem, home); } } } } if (notification.Type == "Plus") { HomeItem home = (HomeItem)notification.Body; home.state++; SendNotification(OrderSystemEvent.ReFreshHouseitem, home); } if (notification.Type == "Over") { HomeItem home = (HomeItem)notification.Body; home.state = 0; SendNotification(OrderSystemEvent.ReFreshHouseitem, home); } }
private void NavigateToExplorer(HomeItem item) { Singleton<MetroExplorerLocalDataSource>.Instance.NavigatorStorageFolders = new List<StorageFolder> { item.StorageFolder }; Frame.Navigate(typeof(PageExplorer), null); }
private HomeItem AddNewItem(GroupInfoList<HomeItem> itemList, StorageFolder retrievedFolder, string token) { HomeItem item = new HomeItem() { Name = retrievedFolder.Name, Path = retrievedFolder.Path, StorageFolder = retrievedFolder, }; if (item.Name.Contains(":\\")) { item.DefautImage = GetBitMapImageFromLocalSource("Assets/Disk.png"); item.ImageStretch = "None"; item.IfImageChanged = "Collapsed"; } else if (item.Name == "Documents") { item.DefautImage = GetBitMapImageFromLocalSource("Assets/File.png"); item.ImageStretch = "None"; item.IfImageChanged = "Collapsed"; } else { item.DefautImage = GetBitMapImageFromLocalSource("Assets/Folder.png"); item.ImageStretch = "UniformToFill"; } itemList.Add(item); _dicItemToken.Add(item, token); return item; }
private async Task GetSubImage(HomeItem folderItem) { if (folderItem.StorageFolder == null) return; var files = (await folderItem.StorageFolder.GetFilesAsync()); if (files != null && files.Count > 0) { if (files.Any(p => p.IsMediaFile())) { var files2 = files.Where(p => p.IsMediaFile() && p.Name != folderItem.SubImageName); if (files2 != null && files2.Count() > 0) { var file = files2.First(); StorageItemThumbnail fileThumbnail = await file.GetThumbnailAsync(ThumbnailMode.SingleItem, 280); BitmapImage bitmapImage = new BitmapImage(); bitmapImage.SetSource(fileThumbnail); folderItem.Image = bitmapImage; folderItem.SubImageName = file.Name; } } } }
public static async Task <bool> CreateSampleHome(string homeName = "Railway House") { Home home = new Home { CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now, OwnerId = "sid:79cb2d8a9896fd48bac1f3969a9965cc", UserId = "sid:79cb2d8a9896fd48bac1f3969a9965cc", HomeId = "", HasAccess = true, Name = homeName, IsPrimary = true, BackgroundUri = "ms-appx:///Leaf.Shared/Images/DefaultHomeBackground.jpg", BackgroundOpacity = 0.5, BackgroundBlur = 20, IsLocationAvailable = false, Location = "Castleconell", UserName = "******", Deleted = false }; HomeItem item = HomeConverter.CreateFrom(home); await HomeTable.Create(item); item.HomeId = HomeTable.HomeItem.Id; await HomeTable.Update(item); //Home hom = (Home)home; //Home Home = new Home(); //{ // Id = "0001", // CreatedAt = "", // UpdatedAt = "", // Version = "", // OwnerId = "", // UserId = "", // HomeId = "", // Name = homeName, // IsPrimary = true, // Background = new Background // { // Uri = "ms-appx:///Leaf.Shared/Images/DefaultHomeBackground.jpg", // Opacity = 0.4, // Blur = 50 // }, // Location = new Location // { // IsLocationAvailable = true, // Address = "Castleconnell" // }, // Rooms = new ObservableCollection<Room>() //}; //Room Room = CreateSampleRoom("0001", "Living Room"); //Home.Rooms.Add(Room); //Room = CreateSampleRoom("0002", "Kitchen"); //Home.Rooms.Add(Room); //Room = CreateSampleRoom("0003", "Bedroom"); //Home.Rooms.Add(Room); //Room = CreateSampleRoom("0004", "Office"); //Home.Rooms.Add(Room); //Room = CreateSampleRoom("0004", "Bathroom"); //Home.Rooms.Add(Room); return(true); }
public void InitHome(HomeItem home) { this.homeItem = home; UpdateState(); }
public Bet(HomeItem data) { BindingContext = betViewModel = new BetViewModel(); NavigationPage.SetHasNavigationBar(this, true); Title = "Bet for " + data.title; BackgroundColor = Color.Bisque; var layout = new StackLayout { Padding = 10, }; var sublayout = new StackLayout { Padding = 10, }; var ItemName = new Label { Text = " Item Name : " + data.title, TextColor = Color.White, BackgroundColor = Color.Blue, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; // name.SetBinding(Label.TextProperty, BetViewModel.NamePropertyName); sublayout.Children.Add(ItemName); var ItemRef = new Label { Text = "Ref : " + data.id, TextColor = Color.White, BackgroundColor = Color.Blue, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; var Ref = new Entry { Text = data.id }; betViewModel.ItemRef = data.id; sublayout.Children.Add(ItemRef); var SellerName = new Label { Text = " Seller Name : " + data.Name, TextColor = Color.White, BackgroundColor = Color.Blue, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; // name.SetBinding(Label.TextProperty, BetViewModel.NamePropertyName); sublayout.Children.Add(SellerName); var currentPrice = new Label { Text = "Current Price : " + data.price, TextColor = Color.White, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = Color.Blue }; // currentPrice.SetBinding(Entry.TextProperty, data.description); sublayout.Children.Add(currentPrice); var Description = new Label { Text = "Description : " + data.description, TextColor = Color.White, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = Color.Blue }; // currentPrice.SetBinding(Entry.TextProperty, data.description); sublayout.Children.Add(Description); layout.Children.Add(sublayout); var newPrice = new Entry { Placeholder = "Enter Price", TextColor = Color.Gray, Text = "", Keyboard = Keyboard.Numeric }; newPrice.SetBinding(Entry.TextProperty, BetViewModel.PricePropertyName); NumericValidationBehavior.SetAttachBehavior(newPrice, true); layout.Children.Add(newPrice); var BetButton = new Button { Text = "Bet", TextColor = Color.White, BackgroundColor = Color.LawnGreen }; BetButton.SetBinding(Button.CommandProperty, BetViewModel.BetCommandPropertyName); layout.Children.Add(BetButton); Content = layout; }