private void Button_Click_Create(object sender, RoutedEventArgs e) { int year = date_picker.Date.Year; int month = date_picker.Date.Month; int day = date_picker.Date.Day; if (title.Text == "" || detail.Text == "") { Empty_Text(); } else if (!Valid_Date(year, month, day)) { InValid_Date_Input(); } else { if ((string)create.Content == "Create") { ListItemViewModel.GetViewModel().AddListItem(title.Text, detail.Text, new DateTime(year, month, day), source); Create_Succeed(); } else if ((string)create.Content == "Update") { ListItemViewModel.GetViewModel().UpdateListItem(ListItemViewModel.GetViewModel().selectedItem.GetID(), title.Text, detail.Text, new DateTime(year, month, day), source); Update_Succeed(); } TileService.UpdateTiles(); title.Text = detail.Text = ""; date_picker.Date = DateTime.Now; create.Content = "Create"; OpenFileWriteBit(); picture.Source = new BitmapImage(new Uri("ms-appx:/Assets/BackGroud.jpg", UriKind.RelativeOrAbsolute)); this.Frame.GoBack(); } }
public FileInfoPageViewModel(INavigationService navigationService, IResourceLoader resourceLoader, DialogService dialogService) { _navigationService = navigationService; _resourceLoader = resourceLoader; _dialogService = dialogService; Directory = DirectoryService.Instance; _tileService = TileService.Instance; //DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); //dataTransferManager.DataRequested += new TypedEventHandler<DataTransferManager, DataRequestedEventArgs>(ShareImageHandler); DownloadCommand = new DelegateCommand(() => { var parameters = new FileDownloadPageParameters { ResourceInfo = ResourceInfo }; _navigationService.Navigate(PageToken.FileDownload.ToString(), parameters.Serialize()); }); DeleteResourceCommand = new DelegateCommand(DeleteResource); RenameResourceCommand = new DelegateCommand(RenameResource); MoveResourceCommand = new RelayCommand(MoveResource); PinToStartCommand = new DelegateCommand <object>(PinToStart, CanPinToStart); }
private void _ProjectPanel_ProjectLoaded(Project project) { _project = project; _projectService = new ProjectService(new ErrorService(), project); _graphicsService = new GraphicsService(_errorService, project); _levelService = new LevelService(_errorService, project); _palettesService = new PalettesService(_errorService, project); _worldService = new WorldService(_errorService, project); _tileService = new TileService(_errorService, project); _textService = new TextService(_errorService, project); _clipBoardService = new ClipBoardService(); _romService = new RomService(_errorService, _graphicsService, _palettesService, _tileService, _levelService, _worldService, _textService); _gameObjectService = new GameObjectService(_errorService, project); _levelService.LevelUpdated += _levelService_LevelUpdated; _worldService.WorldUpdated += _worldService_WorldUpdated; List <WorldInfo> worldInfos = new List <WorldInfo>(); worldInfos.AddRange(project.WorldInfo); worldInfos.Add(project.EmptyWorld); FilePanel.Initialize(_levelService, _worldService); SplashText.Visibility = Visibility.Collapsed; _config.LastProjectPath = _project.DirectoryPath + "\\" + _project.Name + ".json"; }
public void TestAddingShips() { BoardService boardService = new BoardService(); TileService tileService = new TileService(); Ship destroyer = new Ship(ShipType.DESTROYER); Board board = new Board(); boardService.PerformInitialBoardSetup(board); destroyer.IsHorizontal = true; destroyer.RootTile = new Tile { Row = 2, Column = 2 }; tileService.PlaceShip(board, destroyer); Assert.IsTrue(board.TileAt(2, 2).ContainsShip); Assert.IsTrue(board.TileAt(2, 3).ContainsShip); Assert.IsFalse(board.TileAt(2, 4).ContainsShip); Assert.IsFalse(board.TileAt(2, 1).ContainsShip); Assert.IsFalse(board.TileAt(1, 2).ContainsShip); Assert.IsFalse(board.TileAt(3, 2).ContainsShip); }
async private void DeleteAllButton_Click(object sender, RoutedEventArgs e) { ContentDialog DeleteAllConfirm = new ContentDialog { Title = "Warning", Content = "If you delete all the items, you won't be able to recover it. You sure to delete all?", PrimaryButtonText = "Delete", CloseButtonText = "Cancel" }; ContentDialogResult result = await DeleteAllConfirm.ShowAsync(); if (result == ContentDialogResult.Primary) { if (ListItemViewModel.GetViewModel().AllItems.Count == 0) { NoneEventError(); } else { ListItemViewModel.GetViewModel().RemoveAllListItem(); DeleteAll_Succeed(); ListItemViewModel.GetViewModel().selectedItem = null; title.Text = detail.Text = ""; date_picker.Date = DateTime.Now; create.Content = "Create"; //source = null; OpenFileWriteBit(); picture.Source = new BitmapImage(new Uri("ms-appx:/Assets/BackGroud.jpg", UriKind.RelativeOrAbsolute)); TileService.UpdateTiles(); } } else { } }
public void Initialize() { _dispatcher.BeginInvoke(new Action(() => { RegionManager.RegisterViewWithRegion(MainStationView.TabViewRegion, typeof(MainTabView)); RegionManager.RegisterViewWithRegion(MainStationView.TabViewRegion, typeof(RecentMixListView)); RegionManager.RegisterViewWithRegion(MainStationView.TabViewRegion, typeof(PopularMixListView)); RegionManager.RegisterViewWithRegion(MainStationView.TabViewRegion, typeof(HotMixListView)); RegionManager.RegisterViewWithRegion(MainStationView.TabViewRegion, typeof(TagsTabView)); //RegionManager.RegisterViewWithRegion(MainStationView.TabViewRegion, typeof (FavoritesView)); TileService.Add <MainStationView>(new TileData { Title = "8tracks", BackgroundImage = new Uri("pack://siteoforigin:,,,/Resources/Tiles/MB_9999_8tracks.png") }); SearchBarService.Add <MainStationView>(new SearchBarData { Category = "Search_By_Tag", WatermarkText = "Search_By_Tag_Watermark", AutoCompleteProvider = GetMixesByTag }, Tuple.Create("Type", "Tag")); SearchBarService.Add <MainStationView>(new SearchBarData { Category = "Search_By_Artist", WatermarkText = "Search_By_Artist_Watermark", AutoCompleteProvider = GetMixesByTag }, Tuple.Create("Type", "Artist")); }), DispatcherPriority.Background); }
private async void ReLoadItems() { var todoTable = App.MobileService.GetTable <TodoItem>(); List <TodoItem> items = await todoTable .Where(todoItem => todoItem.UserName == UserLogin && todoItem.Complete == false) .OrderBy(todoItem => todoItem.DueTo) .ToListAsync(); DeadList.Clear(); foreach (var v in items) { DeadList.Add(v /*new TodoItem() {Title=v.Title, Text=v.Text, DueTo=v.DueTo}*/); } if (DeadList.Count > 0) { PrimaryTile.IdealTime = DeadList[0].Title; PrimaryTile.IdealMessage = DeadList[0].Text; } else { PrimaryTile.IdealTime = "У вас нет текущих задач."; PrimaryTile.IdealMessage = "Почему бы тебе не попробовать городской квест Quest-City.ru ?"; } TileService.UpdatePrimaryTile(this, null); TileService.SetBadgeCountOnTile(DeadList.Count); }
protected override async void OnNavigatedTo() { NavigationService.ClearHistory(); IsBusy = true; await LoadUserId(); if (!AsanaStateService.NeedToSyncData.HasValue) { AsanaStateService.NeedToSyncData = await new StorageService().CountWorkspaces() == 0; } //FIRST LOAD if (AsanaStateService.NeedToSyncData.Value) { if (await CheckInternetConnection(true)) { LoadDataOnFirstLoad(); } else { IsBusy = false; } } else { await LoadData(); TileService.UpdateMainTile(); } // RatingNotificationService.Run(Container.Resolve<IApplicationSettingsService>(), "Rate our application, we'd like to know what you think about Winsana!", //5,10, "Winsana"); }
public MainPage() { this.InitializeComponent(); this.ViewModel = new ItemListViewModels(); DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(4); timer.Tick += (x, y) => { var updater = TileUpdateManager.CreateTileUpdaterForApplication(); TileNotification notification; var item = ViewModel.AllItems.ElementAt(ItemIndex); var xmlDoc = TileService.CreateTiles(new PrimaryTile(item.title, item.detail, item.date)); notification = new TileNotification(xmlDoc); updater.Update(notification); ItemIndex = (ItemIndex + 1) % ViewModel.AllItems.Count; }; timer.Start(); }
public GraphicsWindow(GraphicsService graphicsService, TileService tileService, PalettesService palettesService) { InitializeComponent(); _graphicsService = graphicsService; _tileService = tileService; _paletteService = palettesService; _graphicsAccessor = new GraphicsAccessor(_graphicsService.GetTilesAtAddress(0)); _graphicsRenderer = new GraphicsSetRender(_graphicsAccessor); _blockRenderer = new BlockRenderer(); Dpi dpi = this.GetDpi(); _graphicsBitmap = new WriteableBitmap(128, 128, dpi.X, dpi.Y, PixelFormats.Bgra32, null); _editorBitmap = new WriteableBitmap(16, 16, dpi.X, dpi.Y, PixelFormats.Bgra32, null); PatternTable.Source = _graphicsBitmap; EditorImage.Source = _editorBitmap; LoadPalettes(); GraphicsType.SelectedIndex = LayoutOrder.SelectedIndex = 0; _paletteService.PalettesChanged += _paletteService_PalettesChanged; }
//将数据库中的Item导入 public async Task AddTodoItems(Models.TodoItem item) { await item.setImg(); AllItems.Add(item); TileService.UpdateTileItem(); //更新磁贴 }
//创建新Item public void AddTodoItem(ImageSource _image, double picSize, string imgName, string title, string description, DateTimeOffset dateTime, bool?isChecked = false, string _id = "") { string id = Guid.NewGuid().ToString(); //生成id AllItems.Add(new Models.TodoItem(id, _image, picSize, imgName, title, description, dateTime, isChecked)); App.db.addItem(new Models.TodoItem(id, _image, picSize, imgName, title, description, dateTime, isChecked)); TileService.UpdateTileItem(); //更新磁贴 }
private void UpdatePrimaryTile(string title, string detail) { var xmlDoc = TileService.CreateTiles(new PrimaryTile(title, detail)); var updater = TileUpdateManager.CreateTileUpdaterForApplication(); TileNotification notification = new TileNotification(xmlDoc); updater.Update(notification); }
public MainPage() { this.InitializeComponent(); ScoreTextBlock.Text = ToDoTask.CompletedTasks.ToString(); ToDoTask.CompletedTasksCountChanged += ToDoTask_CompletedTasksCountChanged; ToDoTask.listOfTasks.CollectionChanged += ListOfTasks_CollectionChanged; enableLiveTileToggle.IsOn = TileService.getServiceAvailablilty(); }
protected int UnuseTiles(string word) { if (word == string.Empty || word == null) { return(0); } return(TileService.UnuseTiles(word)); }
protected int PreviewWord(string word) { if (word == string.Empty || word == null) { return(0); } return(TileService.PreviewTiles(word)); }
public SharesInPageViewModel(INavigationService navigationService, IResourceLoader resourceLoader, DialogService dialogService) : base(navigationService, resourceLoader, dialogService) { _navigationService = navigationService; _resourceLoader = resourceLoader; _dialogService = dialogService; _tileService = TileService.Instance; }
private void UpdateTiles() { var tileXML = TileService.CreateTile(WeatherForecast.GetForecast()); var updater = TileUpdateManager.CreateTileUpdaterForApplication(); TileNotification notification = new TileNotification(tileXML); updater.Update(notification); }
private void UpdatePrimaryTile(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var xmlDoc = TileService.CreateTiles(new PrimaryTile()); var updater = TileUpdateManager.CreateTileUpdaterForApplication(); TileNotification notification = new TileNotification(xmlDoc); updater.Update(notification); }
protected override void OnInitialized() { AddWordModalHidden = true; tiles = TileService.DistributeTiles(); players = PlayerService.ResetPlayers(); selectedWord = ""; selectedName = ""; name = ""; }
private void UpdatePrimaryTile(string input, string input2) { var xmlDoc = TileService.CreateTiles(new PrimaryTile(input, input2)); var updater = TileUpdateManager.CreateTileUpdaterForApplication(); TileNotification notification = new TileNotification(xmlDoc); updater.Update(notification); }
private void UpdatePrimaryTile(object sender, RoutedEventArgs e) { XmlDocument xmlDoc = TileService.CreateTiles(new PrimaryTile()); TileUpdater updater = TileUpdateManager.CreateTileUpdaterForApplication(); TileNotification notification = new TileNotification(xmlDoc); updater.Update(notification); }
private async void DeleteBarButtonClick(object sender, RoutedEventArgs e) { DeleteAppBarButton.Visibility = Visibility.Collapsed; ViewModel1.RemoveListItem(ViewModel1.SelectedItem); ViewModel1.SelectedItem = null; Assignment(); TileService.UpdateTile(); ToastService.DeleteNotify(); await new MessageDialog("Delete successfully!").ShowAsync(); }
private async void MenuFlyoutDelete_Click(object sender, RoutedEventArgs e) { ViewModel1.SelectedItem = (sender as MenuFlyoutItem).DataContext as ListItem; ViewModel1.RemoveListItem(ViewModel1.SelectedItem); ViewModel1.SelectedItem = null; Assignment(); TileService.UpdateTile(); ToastService.DeleteNotify(); await new MessageDialog("Delete successfully!").ShowAsync(); }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { if (ListItemViewModel.GetViewModel().selectedItem != null) { ListItemViewModel.GetViewModel().RemoveListItem(ListItemViewModel.GetViewModel().selectedItem.GetID()); TileService.UpdateTiles(); Delete_Succeed(); this.Frame.GoBack(); } }
public void Start() { Radio.CurrentTrackChanged += RadioOnCurrentTrackChanged; _tileData = new TileData(); _tileData.Title = "Now playing"; _tileData.IsLarge = true; _tileData.BackgroundImage = null; TileService.Add <NowPlayingView>(_tileData, AppRegions.MainRegion); }
public DirectoryListPageViewModel(INavigationService navigationService, IResourceLoader resourceLoader, DialogService dialogService) { _navigationService = navigationService; _resourceLoader = resourceLoader; _dialogService = dialogService; _tileService = TileService.Instance; Settings = SettingsService.Instance.LocalSettings; GroupByNameAscendingCommand = new DelegateCommand(() => { Directory.GroupByNameAscending(); SelectedFileOrFolder = null; }); GroupByNameDescendingCommand = new DelegateCommand(() => { Directory.GroupByNameDescending(); SelectedFileOrFolder = null; }); GroupByDateAscendingCommand = new DelegateCommand(() => { Directory.GroupByDateAscending(); SelectedFileOrFolder = null; }); GroupByDateDescendingCommand = new DelegateCommand(() => { Directory.GroupByDateDescending(); SelectedFileOrFolder = null; }); GroupBySizeAscendingCommand = new DelegateCommand(() => { Directory.GroupBySizeAscending(); SelectedFileOrFolder = null; }); GroupBySizeDescendingCommand = new DelegateCommand(() => { Directory.GroupBySizeDescending(); SelectedFileOrFolder = null; }); RefreshCommand = new DelegateCommand(async() => { ShowProgressIndicator(); await Directory.Refresh(); HideProgressIndicator(); }); CreateDirectoryCommand = new DelegateCommand(CreateDirectory); UploadFilesCommand = new DelegateCommand(UploadFiles); UploadPhotosCommand = new DelegateCommand(UploadPhotos); DownloadResourceCommand = new RelayCommand(DownloadResource); DeleteResourceCommand = new RelayCommand(DeleteResource); RenameResourceCommand = new RelayCommand(RenameResource); MoveResourceCommand = new RelayCommand(MoveResource); //PinToStartCommand = new DelegateCommand<object>(PinToStart, CanPinToStart); PinToStartCommand = new DelegateCommand <object>(PinToStart); }
private async void CreateClick(object sender, RoutedEventArgs e) { StringBuilder start = new StringBuilder(); StringBuilder end = new StringBuilder(); start.AppendFormat("{0}/{1}/{2} {3}:{4}:00", startDate.Date.Year, startDate.Date.Month, startDate.Date.Day, startTime.Time.Hours, startTime.Time.Minutes); end.AppendFormat("{0}/{1}/{2} {3}:{4}:00", endDate.Date.Year, endDate.Date.Month, endDate.Date.Day, endTime.Time.Hours, endTime.Time.Minutes); if (place.Text == "" || name.Text == "" || detail.Text == "" || maxNum.Text == "") { var show = new MessageDialog("各项输入不得为空").ShowAsync(); return; } string pattern = @"^[0-9]*$"; if (!Regex.IsMatch(maxNum.Text, pattern)) { var show = new MessageDialog("最大人数不合法").ShowAsync(); return; } if (int.Parse(maxNum.Text) <= 0) { var show = new MessageDialog("最大参与人数要大于0").ShowAsync(); return; } if (DateTime.Parse(start.ToString()).CompareTo(DateTime.Now) == -1 || DateTime.Parse(end.ToString()).CompareTo(DateTime.Parse(start.ToString())) == -1) { var show = new MessageDialog("起始时间要大于当前日期且结束时间不得小于起始时间").ShowAsync(); return; } if (place.Tag == null) { var show = new MessageDialog("当前地址不存在").ShowAsync(); return; } if ((string)create.Content == "Create") { await Services.EventServices.addEvent(Store.getInstance().getToken(), name.Text, detail.Text, start.ToString(), end.ToString(), place.Tag.ToString(), maxNum.Text, file); } else { await Services.EventServices.updateEvent(Store.getInstance().getToken(), name.Tag.ToString(), name.Text, detail.Text, start.ToString(), end.ToString(), place.Tag.ToString(), maxNum.Text, file); } ControlBar.Current.NavigateToPage("Index"); TileService.UpdateTiles(); }
private async void Create_Update(object sender, RoutedEventArgs e) { string message = ""; if (title.Text == "") { message += "Title"; } if (detail.Text == "") { if (message != "") { message += ",Detail"; } else { message += "Detail"; } } if (message != "") { message += "不得为空\n"; } if (datePicker.Date < DateTimeOffset.Now.LocalDateTime.AddDays(-1)) { message += "时间不得小于当前日期"; } if (message != "") { await new MessageDialog(message).ShowAsync(); } else if (create_update.Content.ToString() == "Create") { Frame rootFrame = Window.Current.Content as Frame; //Debug.WriteLine(datePicker.Date.LocalDateTime); ViewModel1.AddListItem(pic.Source, GetSelectPicture.picPath, slider.Value, title.Text, detail.Text, datePicker.Date); rootFrame.Navigate(typeof(MainPage)); TileService.UpdateTile(); ToastService.CreateNotify(); await new MessageDialog("Create successfully!").ShowAsync(); } else { Frame rootFrame = Window.Current.Content as Frame; ViewModel1.UpdateListItem(pic.Source, GetSelectPicture.picPath, slider.Value, title.Text, detail.Text, datePicker.Date); rootFrame.Navigate(typeof(MainPage)); ViewModel1.SelectedItem = null; TileService.UpdateTile(); ToastService.UpdateNotify(); await new MessageDialog("Update successfully!").ShowAsync(); } }
private async void Login_Clicked(object sender, RoutedEventArgs e) { UserInfo.UserName = UserName.Text; UserInfo.Password = Password.Password; //登陆验证模块 JObject logIn = await API.GetAPI().Login(UserInfo.UserName, UserInfo.Password); if ((bool)logIn["state"]) { //登陆成功后 UserInfo.IsLogged = true; errorMessage.Text = ""; Login_Button.Visibility = Visibility.Collapsed; NavMenuPrimaryListView.IsItemClickEnabled = true; NavMenuBottomListView.IsItemClickEnabled = true; UserInfo.IsLogged = true; UserInfoState.Hide(); matchesVM.AllMatches.Clear(); JObject Matches = new JObject(); Matches = await API.GetAPI().queryAllMatchesAsync(); if ((bool)Matches["state"]) { foreach (var match in Matches["pingpong"]) { matchesVM.AllMatches.Add(new Matches("pingpong", match["title"].ToString(), match["date"].ToString(), match["matchType"].ToString(), match["matchLastTime"].ToString(), match["place"].ToString(), match["placeContain"].ToString(), match["sectionPerDay"].ToString(), match["seed"].ToString())); } foreach (var match in Matches["badminton"]) { matchesVM.AllMatches.Add(new Matches("badminton", match["title"].ToString(), match["date"].ToString(), match["matchType"].ToString(), match["matchLastTime"].ToString(), match["place"].ToString(), match["placeContain"].ToString(), match["sectionPerDay"].ToString(), match["seed"].ToString())); } foreach (var match in Matches["tennis"]) { matchesVM.AllMatches.Add(new Matches("tennis", match["title"].ToString(), match["date"].ToString(), match["matchType"].ToString(), match["matchLastTime"].ToString(), match["place"].ToString(), match["placeContain"].ToString(), match["sectionPerDay"].ToString(), match["seed"].ToString())); } ContentFrame.Navigate(typeof(Home)); TileService.UpdateTileItem(); } else { //await new MessageDialog("").ShowAsync(); } } else { //登陆失败后 errorMessage.Text = (string)logIn["errormessage"]; } }