private void OnGroupCommand(string prm) { if (prm?.ToLower() == "add") { GroupDialog dlg = new GroupDialog(Unit); dlg.ShowDialog(); } else if (prm?.ToLower() == "remove") { if (SelectedGroep != null) { Unit.Groepen.Delete(SelectedGroep); Unit.Save(); } } }
public GameScene() { MapControl.AutoRun = false; MapControl.AutoHit = false; Slaying = false; Thrusting = false; HalfMoon = false; CrossHalfMoon = false; DoubleSlash = false; TwinDrakeBlade = false; FlamingSword = false; GroupDialog.GroupList.Clear(); Scene = this; BackColour = Color.Transparent; MoveTime = CMain.Time; KeyDown += GameScene_KeyDown; MainDialog = new MainDialog { Parent = this }; ChatDialog = new ChatDialog { Parent = this }; ChatControl = new ChatControlBar { Parent = this }; InventoryDialog = new InventoryDialog { Parent = this }; CharacterDialog = new CharacterDialog { Parent = this, Visible = false }; BeltDialog = new BeltDialog { Parent = this }; StorageDialog = new StorageDialog { Parent = this, Visible = false }; MiniMapDialog = new MiniMapDialog { Parent = this }; InspectDialog = new InspectDialog { Parent = this, Visible = false }; OptionDialog = new OptionDialog { Parent = this, Visible = false }; MenuDialog = new MenuDialog { Parent = this, Visible = false }; NPCDialog = new NPCDialog { Parent = this, Visible = false }; NPCGoodsDialog = new NPCGoodsDialog { Parent = this, Visible = false }; NPCDropDialog = new NPCDropDialog { Parent = this, Visible = false }; NPCAwakeDialog = new NPCAwakeDialog { Parent = this, Visible = false }; HelpDialog = new HelpDialog { Parent = this, Visible = false }; MountDialog = new MountDialog { Parent = this, Visible = false }; FishingDialog = new FishingDialog { Parent = this, Visible = false }; FishingStatusDialog = new FishingStatusDialog { Parent = this, Visible = false }; GroupDialog = new GroupDialog { Parent = this, Visible = false }; GuildDialog = new GuildDialog { Parent = this, Visible = false }; GuildBuffDialog = new GuildBuffDialog { Parent = this, Visible = false }; BigMapDialog = new BigMapDialog { Parent = this, Visible = false }; TrustMerchantDialog = new TrustMerchantDialog { Parent = this, Visible = false }; CharacterDuraPanel = new CharacterDuraPanel { Parent = this, Visible = false }; DuraStatusPanel = new DuraStatusDialog { Parent = this, Visible = true }; TradeDialog = new TradeDialog { Parent = this, Visible = false }; GuestTradeDialog = new GuestTradeDialog { Parent = this, Visible = false }; SkillBarDialog = new SkillBarDialog { Parent = this, Visible = false }; ChatOptionDialog = new ChatOptionDialog { Parent = this, Visible = false }; ChatNoticeDialog = new ChatNoticeDialog { Parent = this, Visible = false }; QuestListDialog = new QuestListDialog { Parent = this, Visible = false }; QuestDetailDialog = new QuestDetailDialog {Parent = this, Visible = false}; QuestTrackingDialog = new QuestTrackingDialog { Parent = this, Visible = false }; QuestLogDialog = new QuestDiaryDialog {Parent = this, Visible = false}; RankingDialog = new RankingDialog { Parent = this, Visible = false }; MailListDialog = new MailListDialog { Parent = this, Visible = false }; MailComposeLetterDialog = new MailComposeLetterDialog { Parent = this, Visible = false }; MailComposeParcelDialog = new MailComposeParcelDialog { Parent = this, Visible = false }; MailReadLetterDialog = new MailReadLetterDialog { Parent = this, Visible = false }; MailReadParcelDialog = new MailReadParcelDialog { Parent = this, Visible = false }; IntelligentCreatureDialog = new IntelligentCreatureDialog { Parent = this, Visible = false };//IntelligentCreature IntelligentCreatureOptionsDialog = new IntelligentCreatureOptionsDialog { Parent = this, Visible = false };//IntelligentCreature IntelligentCreatureOptionsGradeDialog = new IntelligentCreatureOptionsGradeDialog { Parent = this, Visible = false };//IntelligentCreature RefineDialog = new RefineDialog { Parent = this, Visible = false }; RelationshipDialog = new RelationshipDialog { Parent = this, Visible = false }; FriendDialog = new FriendDialog { Parent = this, Visible = false }; MemoDialog = new MemoDialog { Parent = this, Visible = false }; MentorDialog = new MentorDialog { Parent = this, Visible = false }; GameShopDialog = new GameShopDialog { Parent = this, Visible = false }; //not added yet KeyboardLayoutDialog = new KeyboardLayoutDialog { Parent = this, Visible = false }; for (int i = 0; i < OutputLines.Length; i++) OutputLines[i] = new MirLabel { AutoSize = true, BackColour = Color.Transparent, Font = new Font(Settings.FontName, 10F), ForeColour = Color.LimeGreen, Location = new Point(20, 25 + i * 13), OutLine = true, }; }
public async void FileUpload(List <StorageFile> imgList) { if (imgList.Count > 0) { // 弹出组选择框 var groupDialog = new GroupDialog(); groupDialog.PrimaryButtonClick += async(_s, _e) => { // 选定分组后,上传图片 if (groupDialog.SelectGroup != null) { var errorFile = new List <StorageFile>(); UploadInfoCollection.Clear(); UploadProgressCollection.Clear(); var imgItemList = new List <OneDriveImage>(); var imgTemp = await AppTools.ConvertFileToImage(imgList[0]); // 如果仅一张图片上传,则显示该图片的分辨率、大小等信息 if (imgList.Count == 1) { var fileInfo = await imgList[0].GetBasicPropertiesAsync(); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("RP"), imgTemp.PixelWidth + "x" + imgTemp.PixelHeight)); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("ImageSize"), Math.Round((fileInfo.Size / (1024.0 * 1024.0)), 1) + "M")); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("ImageType"), Path.GetExtension(imgList[0].Path).Substring(1).ToUpper())); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("CreateDate"), fileInfo.DateModified.ToString("yyyy/MM/dd"))); } // 如果有多张图片上传,则显示总览信息 else { double size = 0; foreach (var item in imgList) { var fileInfo = await item.GetBasicPropertiesAsync(); size += Math.Round((fileInfo.Size / (1024.0 * 1024.0)), 1); } UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("ImageCount"), imgList.Count.ToString())); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("GroupName"), groupDialog.SelectGroup.GroupName)); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("AllSize"), size + "M")); } // 将上传列表的第一张图片作为上传区域背景 var backBrush = new ImageBrush(); backBrush.Stretch = Stretch.UniformToFill; backBrush.ImageSource = imgTemp; UploadArea.Background = backBrush; // 隐藏上传提示字符 UploadAreaHold.Visibility = Visibility.Collapsed; double uploadColumnWidth = UploadColumn.ActualWidth - 30; // 根据上传信息显示的数目来确定单一信息所占区域大小 UploadInfoWidth = uploadColumnWidth / UploadInfoCollection.Count; // 装载进度条 for (int i = 0; i < imgList.Count; i++) { var item = imgList[i]; UploadProgressCollection.Add(new ProgressStatus(i + 1, item.DisplayName)); } // 开始逐一上传图片 foreach (var item in imgList) { var img = await App.OneDriveTools.UploadImage(item, groupDialog.SelectGroup); // 图片若上传错误,则加入错误文件列表中 if (img == null) { errorFile.Add(item); } // 否则,写入成功列表 else { imgItemList.Add(img); LastestImageCollection.Insert(0, img); if (LastestNoDataTipBlock.Visibility == Visibility.Visible) { LastestNoDataTipBlock.Visibility = Visibility.Collapsed; LastestListView.Visibility = Visibility.Visible; } for (int j = UploadProgressCollection.Count - 1; j >= 0; j--) { if (UploadProgressCollection[j].Name.Replace($"[{j + 1}] ", "") == item.DisplayName) { UploadProgressCollection.RemoveAt(j); } } } } // 所有任务上传完成,清空背景,加入占位符 var res = App.Current.RequestedTheme == ApplicationTheme.Dark ? (ResourceDictionary)App.Current.Resources.ThemeDictionaries["Dark"] : (ResourceDictionary)App.Current.Resources.ThemeDictionaries["Light"]; var color = (SolidColorBrush)res["MainBackground"]; UploadArea.Background = color; UploadAreaHold.Visibility = Visibility.Visible; // 恢复默认上传信息 UploadInfoCollection.Clear(); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("DefaultUploadInfoTitle"), AppTools.GetReswLanguage("None"))); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("ImageSize"), AppTools.GetReswLanguage("None"))); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("ImageType"), AppTools.GetReswLanguage("None"))); UploadInfoCollection.Add(new KeyValue(AppTools.GetReswLanguage("CreateDate"), AppTools.GetReswLanguage("None"))); UploadInfoWidth = uploadColumnWidth / UploadInfoCollection.Count; // 清除上传进度条 UploadProgressCollection.Clear(); // 当成功列表中有数据时,显示成功数目,并将成功上传的图片反映在UI上 if (imgItemList.Any()) { int num = await App.OneDriveTools.AddImageToDatabase(App.Db, imgItemList); string msg = AppTools.GetReswLanguage("AddImageSuccess").Replace("{count}", num.ToString()); var tipDialog = new TipDialog(AppTools.GetReswLanguage("AddSuccessTitle"), msg); await tipDialog.ShowAsync(); AppTools.WriteLocalSetting(AppSettings.SelectGroupIndex, groupDialog.SelectGroup.GroupId); GroupInit(groupDialog.SelectGroup); } // 如果错误列表中有数据,则提醒用户 if (errorFile.Any()) { int num = errorFile.Count; string msg = AppTools.GetReswLanguage("AddImageFailed").Replace("{count}", num.ToString()); var tipDialog = new TipDialog(AppTools.GetReswLanguage("AddFailTitle"), msg); await tipDialog.ShowAsync(); } } }; await groupDialog.ShowAsync(); } }
private void NewTagButton_Click(object sender, EventArgs e) { //Get last IndexEntry last = Map.IndexEntries.Last; if (last.Root != HaloTags.ugh_) { return; } //Prepare using (GroupDialog groupDlg = new GroupDialog()) { //Show if (groupDlg.ShowDialog() == DialogResult.OK) { using (NameDialog nameDialog = new NameDialog()) if (nameDialog.ShowDialog() == DialogResult.OK) { //Prepare string tagName = nameDialog.TagName; Group tagGroup = TagLookup.CreateTagGroup(groupDlg.SelectedGroup); //Check if (tagGroup != null) { if (groupDlg.SelectedGroup == HaloTags.ltmp || groupDlg.SelectedGroup == HaloTags.sbsp) { //Ask for which BSP index to build into using (StructureBspSelectDialog bspSelectDlg = new StructureBspSelectDialog(Map.Scenario)) if (bspSelectDlg.ShowDialog() == DialogResult.OK && bspSelectDlg.SelectedBlockIndex >= 0) { //Create tag ScenarioStructureTag tag = new ScenarioStructureTag(bspSelectDlg.SelectedBlockIndex) { TagGroup = tagGroup, Name = tagName, Id = last.Id, }; //Add Map.AddScenarioStructureTags(tag); } } else { //Create tag Tag tag = new Tag() { TagGroup = tagGroup, Name = tagName, Id = last.Id, }; //Add Map.AddTags(tag); } } //Reload Host.Request(this, "ReloadMap"); } } } }
public GroupPage() { _groupDialog = new GroupDialog(); InitializeComponent(); }
private async void RemoveGroupButton_Click(object sender, RoutedEventArgs e) { // 移除当前组要注意组内是否还有其他的图片,有的话要注意转移 int GroupCount = GroupCollection.Count; if (GroupCount <= 1) { new PopupMaskTip(AppTools.GetReswLanguage("OnlyOneGroup")).Show(); return; } var con = AppTools.GetParentObject <Grid>((FrameworkElement)sender, "GroupItemContainer"); var idCon = AppTools.GetChildObject <TextBlock>(con, "ItemId"); string id = idCon.Text; if (!string.IsNullOrEmpty(id)) { var item = App.Db.Groups.Where(p => p.GroupId == id).ToList()[0]; var deleteDialog = new TipDialog(AppTools.GetReswLanguage("DeleteGroupTitle"), AppTools.GetReswLanguage("DeleteGroupTip"), AppTools.GetReswLanguage("MoveImage"), AppTools.GetReswLanguage("Delete")); var chooseResult = await deleteDialog.ShowAsync(); if (chooseResult == ContentDialogResult.Primary) { // 转移图片 int count = App.Db.Images.Where(p => p.GroupId == item.GroupId).Count(); if (count > 0) { var groupDialog = new GroupDialog(); var groupResult = await groupDialog.ShowAsync(); if (groupResult == ContentDialogResult.Primary) { var selectGroup = groupDialog.SelectGroup; if (selectGroup.Equals(item)) { new PopupMaskTip(AppTools.GetReswLanguage("Sao")).Show(); return; } else { foreach (var img in App.Db.Images) { if (img.GroupId == item.GroupId) { img.GroupId = selectGroup.GroupId; img.GroupName = selectGroup.GroupName; } } App.Db.Groups.Remove(item); await App.Db.SaveChangesAsync(); GroupCollection.Remove(item); MainPage.Current.GroupCollectionRemoved(item); MainPage.Current.HistoryInit(); AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True"); new PopupMaskTip(AppTools.GetReswLanguage("MoveImageSuccess")).Show(); await Task.Delay(800); new PopupMaskTip(AppTools.GetReswLanguage("DeleteGroupSuccess")).Show(); } } } else { App.Db.Groups.Remove(item); await App.Db.SaveChangesAsync(); new PopupMaskTip(AppTools.GetReswLanguage("DeleteGroupSuccess")).Show(); } } else if (chooseResult == ContentDialogResult.Secondary) { // 直接删除分组 var images = App.Db.Images.Where(p => p.GroupId == item.GroupId); var waittingTip = new HoldMaskTip(AppTools.GetReswLanguage("Deleting")); waittingTip.Show(); int count = 0; if (images.Count() > 0) { count = await App.OneDriveTools.DeleteImage(images.ToList()); } if (count > 0) { App.Db.Images.RemoveRange(images); string msg = AppTools.GetReswLanguage("DeleteImageSuccess").Replace("{count}", count.ToString()); new PopupMaskTip(msg).Show(); } App.Db.Groups.Remove(item); await App.Db.SaveChangesAsync(); waittingTip.Close(); GroupCollection.Remove(item); MainPage.Current.GroupCollectionRemoved(item); MainPage.Current.LastestInit(); MainPage.Current.HistoryInit(); AppTools.WriteLocalSetting(AppSettings.IsDatabaseChanged, "True"); await Task.Delay(800); new PopupMaskTip(AppTools.GetReswLanguage("DeleteGroupSuccess")).Show(); } } }