private async void MenuItem_Clicked(object sender, EventArgs e) { if ((sender as Xamarin.Forms.MenuItem).BindingContext is ChoiceOption obj) { await Navigation.PushAsync(InfoPage.Show(obj.Value)); } }
public MainPage() { this.InitializeComponent(); InfoPage info = new InfoPage(); info.InitializeComponent(); }
private async void Info_Clicked(object sender, EventArgs e) { if ((sender as MenuItem).BindingContext is NamesViewModel f) { await Navigation.PushAsync(InfoPage.Show(new Feature(f.Text, f.Detail))); } }
private async void MenuItem_Clicked_1(object sender, EventArgs e) { if ((sender as MenuItem).BindingContext is ChoiceOption obj && obj.Feature is IXML) { await Navigation.PushAsync(InfoPage.Show(obj.Feature)); } }
public ItemViewModel(PlayerInventoryViewModel context, Possession possession) { Context = context; Value = possession; BaseItemInfo = new Command(async() => { await Context.Navigation.PushAsync(InfoPage.Show(Value.Item)); }, () => Value.BaseItem != null); ShowInfo = new Command(async(par) => { if (par is MagicViewModel m) { await Context.Navigation.PushAsync(InfoPage.Show(m.Magic)); } }); OnDelete = new Command((par) => { if (par is MagicViewModel m) { Value.MagicProperties.RemoveAll(s => ConfigManager.SourceInvariantComparer.Equals(s, m.Magic.Name + " " + ConfigManager.SourceSeperator + " " + m.Magic.Source)); Magic.ReplaceRange(new List <MagicViewModel>()); UpdateMagic(); IsChanged = true; Context.FirePlayerChanged(); } }); UpdateMagic(); }
private async void SkillInfo(object sender, EventArgs e) { if ((sender as Xamarin.Forms.MenuItem).BindingContext is SkillInfo obj) { await Navigation.PushAsync(InfoPage.Show(obj.Skill)); } }
public PlayerInventoryViewModel(PlayerModel parent) : base(parent, "Inventory") { Image = ImageSource.FromResource("CB_5e.images.inventory.png"); parent.PlayerChanged += Parent_PlayerChanged; EditItem = new Command(async(par) => { if (par is InventoryViewModel ivm) { if (ivm.Item != null) { await Navigation.PushAsync(new ItemPage(new ItemViewModel(this, ivm.Item))); } else { await Navigation.PushAsync(InfoPage.Show(ivm.Boon)); } } }); ShowItemInfo = new Command(async(par) => { if (par is InventoryViewModel ivm) { if (ivm.Item is Possession p) { await Navigation.PushAsync(InfoPage.Show(new DisplayPossession(ivm.Item, Context.Player))); } else { await Navigation.PushAsync(InfoPage.Show(ivm.Boon)); } } }); DeleteItem = new Command((par) => { if (par is InventoryViewModel ivm) { if (ivm.Item is Possession p) { Context.MakeHistory(""); Context.Player.RemovePossessionAndItems(p); Save(); } else if (ivm.Boon is Feature f) { Context.MakeHistory(""); Context.Player.RemoveBoon(f); Save(); } FirePlayerChanged(); } }); RefreshItems = new Command(() => { ItemsBusy = true; UpdateItems(); OnPropertyChanged("Carried"); ItemsBusy = false; }); UpdateItems(); }
private void show_prod_page(object sender, RoutedEventArgs e) { InfoPage info_page = this.MainGrid.FindName("UCInformation") as InfoPage; //show info page, hide the rest info_page.Visibility = Visibility.Collapsed; }
public PlayerShopViewModel(PlayerModel parent) : base(parent, "Shop") { Image = ImageSource.FromResource("CB_5e.images.shop.png"); OnOpenShop = new Command(async(par) => { if (par is ShopViewModel svm) { await Navigation.PushAsync(new ShopSubPage(svm)); } }); ShowItemInfo = new Command(async(par) => { if (par is InventoryViewModel ivm) { if (ivm.Item is Possession p) { await Navigation.PushAsync(InfoPage.Show(new DisplayPossession(ivm.Item, Context.Player))); } else { await Navigation.PushAsync(InfoPage.Show(ivm.Boon)); } } }); UpdateShops(); }
void GenPage(string title, string info) { var page = new InfoPage(); page.title = title; page.desc = info; pages.Add(page); }
private async void InfoSelected(object sender, SelectedItemChangedEventArgs e) { if (e.SelectedItem is MonsterInfo obj) { await Navigation.PushAsync(InfoPage.Show(obj.Monster)); } ((ListView)sender).SelectedItem = null; }
public void TestDefaultCtor() { // set up var page = new InfoPage(); // check Assert.IsTrue(page.Title.Length > 0, "page title must have been set"); }
private void InfoPageButton_Click(object sender, EventArgs e) { MainPanel.Controls.Clear(); SetTitle(Nazwy.strInfo); var infopage = new InfoPage(); AddToList(Nazwy.strInfo, infopage); MainPanel.Controls.Add(infopage); }
private void Form1_Load(object sender, EventArgs e) { loadControls(); bunifuPages1.SetPage("Dashboard"); dasboardTemplate = new DashboardPage(); DashboardPg.Controls.Add(dasboardTemplate); InfoPage infoTemplate = new InfoPage(); UserInfo.Controls.Add(infoTemplate); }
private void InfomationWindowVisible_Click(object sender, EventArgs e) { if (InfomationWindow.Checked) { InfoPage.Hide(); } else { InfoPage.Show(MainDockPanel, DockState.DockBottomAutoHide); } InfomationWindow.Checked = !InfomationWindow.Checked; }
public MainPage() { Current = this; this.InitializeComponent(); LoggingSystem.LoggingSystem.SystemControl.ReturnDataEvent += SystemControl_ReturnDataEvent; InfoPage.Navigate(typeof(ShowInfo)); LoginPage.Navigate(typeof(ShowLogin)); AboutPage.Navigate(typeof(ShowAbout)); NoticePage.Navigate(typeof(ShowNotice)); EasterPage.Navigate(typeof(EasterEggPage)); SettingPage.Navigate(typeof(ShowSettings)); //BillPage.Navigate(typeof(ShowBill)); }
public static void ClassInitialize(TestContext testContext) { CreateScreenshotsDirectory(); _driver = new WebDriver(); _driver.Start(Browser.Chrome); _homePage = new HomePage(_driver); _searchpage = new SearchPage(_driver); _advancedSearchPage = new AdvancedSearchPage(_driver); _advancedSearchResultsPage = new AdvancedSearchResultsPage(_driver); _infoPage = new InfoPage(_driver); }
public EditMagic(MagicEditModel model, Task items) { BindingContext = Model = model; Model.Matches = new Command(async() => { IsBusy = true; await items; Feature f = new Feature("Matching", "\n" + String.Join("\n", from i in Model.Context.FilterPreview(Model.Base) select i.Name + " " + ConfigManager.SourceSeperator + " " + i.Source), 0, true); await Navigation.PushAsync(InfoPage.Show(f)); IsBusy = false; }); InitializeComponent(); Model.TrackChanges = true; }
private void LoadViewSetting() { if (System.IO.File.Exists(Config.ViewSettingFileName)) { var setting = XmlHelper.XmlDeserialize( Config.ViewSettingFileName, typeof(ViewSetting)) as ViewSetting; if (setting != null) { Config.LocalSetting.NeedDebug = Debug.Checked = setting.EnableDebug; InfomationWindow.Checked = setting.InformationWindow; if (InfomationWindow.Checked) { InfoPage.Show(); } else { InfoPage.Hide(); } ProxyWindow.Checked = setting.ProxyWindow; if (ProxyWindow.Checked) { ProxyPage.Show(); } else { ProxyPage.Hide(); } MainStatusBar.Visible = RightStatusBar.Checked = StatusBar.Checked = setting.StatusBar; MainToolbar.Visible = RightToolBar.Checked = ToolBar.Checked = setting.ToolBar; MainMenu.Visible = RightMenuBar.Checked = MenuBar.Checked = setting.MenuBar; } else { System.IO.File.Delete(Config.ViewSettingFileName); SplashScreen.CloseSplashScreen(); _hasViewSettingException = true; MsgBox.ShowErrorMessage("ViewSetting.xml not found!"); Close(); } } }
private async void ResourceInfo(object sender, EventArgs e) { if ((sender as MenuItem).BindingContext is ResourceViewModel rs) { if (rs.Value is ModifiedSpell ms) { ms.Info = Model.Context.Player.GetAttack(ms, ms.differentAbility); ms.Modifikations.AddRange(from f in Model.Context.Player.GetFeatures() where f is SpellModifyFeature && Utils.Matches(Model.Context, ms, ((SpellModifyFeature)f).Spells, null) select f); ms.Modifikations = ms.Modifikations.Distinct().ToList(); await Navigation.PushAsync(InfoPage.Show(ms)); } if (rs.Value is ResourceInfo r) { await Navigation.PushAsync(InfoPage.Show(Model.Context.Player.GetResourceFeatures(r.ResourceID))); } } }
private void TapInfo(UITapGestureRecognizer tap) { if (!tapped) { tapped = true; System.Diagnostics.Debug.WriteLine("đã chạm info"); //UIApplication.SharedApplication.OpenUrl(new NSUrl("http://ezcheck.vn")); var newInfoPage = new InfoPage(); Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(newInfoPage); tapped = false; } else { //tap.View.Transform *= CGAffineTransform.MakeRotation((float)-Math.PI / 2); tapped = false; System.Diagnostics.Debug.WriteLine("hủy chạm"); } }
// This method is invoked when the application has loaded its UI and its ready to run public override bool FinishedLaunching(UIApplication app, NSDictionary options) { tabBarItemiBooze.Image = UIImage.FromFile("drunken_duck_Beer_2_32x32.png"); tabBarItemInfo.Image = UIImage.FromFile("missiridia_Universal_information_symbol_32x32.png"); tabBarItemAbout.Image = UIImage.FromFile("Copyright.png"); var aboutUrl = new NSUrlRequest(NSUrl.FromFilename("copyright.html")); AboutPage.LoadRequest(aboutUrl); var infoUrl = new NSUrlRequest(NSUrl.FromFilename("info.html")); InfoPage.LoadRequest(infoUrl); // If you have defined a view, add it here: window.AddSubview(tabBarController.View); window.MakeKeyAndVisible(); return(true); }
/// <summary> /// /// </summary> /// <param name="TOCnode"></param> /// <param name="tree"></param> /// <param name="level"></param> private void FillSampleListIntern(XmlNode TOCnode, TreeNodeCollection nodes) { // Loop through all XML nodes int nodeID = 0; XmlNode node = TOCnode.FirstChild; while(node != null) { if(node.Name == "TOCNode") { // Add node into the tree nodeID = nodes.Add(new TreeNode(node.Attributes["Title"].Value)); // Add all child nodes FillSampleListIntern(node, nodes[nodeID].Nodes); } else if(node.Name == "SampleConfig") { // Add node into the tree nodeID = nodes.Add(new TreeNode(node["Title"].InnerText)); // Create sample information object if(node["SampleControl"] != null) { SampleInfo sampleInfo = new SampleInfo(); sampleInfo.sampleControl = node["SampleControl"].InnerText; sampleInfo.path = node.Attributes["Path"].Value; if(node["Keywords"] != null) sampleInfo.keywords = node["Keywords"].InnerText; if(node["ShortBlurb"] != null) sampleInfo.shortBlurb = node["ShortBlurb"].InnerText; if(node["Thumbnail"] != null) sampleInfo.thumbnail = node["Thumbnail"].InnerText; if(node["Title"] != null) sampleInfo.title = node["Title"].InnerText; // Fill info pages list XmlNode nodeInfoPages = node["InfoPages"]; if(nodeInfoPages != null && nodeInfoPages.HasChildNodes) { XmlNode nodeInfo = nodeInfoPages.FirstChild; while(nodeInfo != null) { if(nodeInfo.Name == "InfoPage") { InfoPage newInfoPage = new InfoPage(); newInfoPage.title = nodeInfo.Attributes["Title"].Value; newInfoPage.data = nodeInfo.InnerText; sampleInfo.infoPages.Add(newInfoPage); } nodeInfo = nodeInfo.NextSibling; } } // Fill keywords array XmlNode nodeKeywords = node["Keywords"]; if(nodeKeywords != null && nodeKeywords.HasChildNodes) { XmlNode nodeInfo = nodeKeywords.FirstChild; while(nodeInfo != null) { if(nodeInfo.Name == "Keyword") { IndexInfo indexInfo = new IndexInfo(); indexInfo.SampleInfo = sampleInfo; indexInfo.Key = nodeInfo.InnerText.Trim(); // Check if string has a sub index separated with comma int commaIndex = indexInfo.Key.IndexOf(','); if(commaIndex > 0) { indexInfo.SubKey = indexInfo.Key.Substring(commaIndex + 1).Trim(); indexInfo.Key = indexInfo.Key.Substring(0, commaIndex).Trim(); } this.indexInfoList.Add(indexInfo); } nodeInfo = nodeInfo.NextSibling; } } // Add sample information to the tree node nodes[nodeID].Tag = sampleInfo; // Set node image int imageIndex = 2; if(sampleInfo.infoPages != null && sampleInfo.infoPages.Count == 1) { InfoPage infoPage = (InfoPage)sampleInfo.infoPages[0]; if(infoPage.title == "Gallery") { // Set Gallery list image imageIndex = 3; } else if(infoPage.title == "Overview") { // Set Gallery list image imageIndex = 4; } } nodes[nodeID].ImageIndex = imageIndex; nodes[nodeID].SelectedImageIndex = imageIndex; } } // Get next node node = node.NextSibling; } }
private void AddServerTvCards(Servers servers, IList <Server> dbsServers, bool reloaded) { foreach (Server server in dbsServers) { bool isLocal = (server.HostName.ToLowerInvariant() == Dns.GetHostName().ToLowerInvariant() || server.HostName.ToLowerInvariant() == Dns.GetHostName().ToLowerInvariant() + "." + System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName. ToLowerInvariant()); cardPage = new TvCards(server.HostName); cardPage.TvCardsChanged += OnTvCardsChanged; AddChildSection(servers, cardPage, 0); foreach (Card dbsCard in server.ReferringCard()) { if (dbsCard.Enabled == true && RemoteControl.Instance.CardPresent(dbsCard.IdCard)) { CardType type = RemoteControl.Instance.Type(dbsCard.IdCard); int cardId = dbsCard.IdCard; string cardName = dbsCard.Name; switch (type) { case CardType.Analog: cardName = String.Format("{0} Analog {1}", cardId, cardName); AddChildSection(cardPage, new CardAnalog(cardName, dbsCard.IdCard), 1); break; case CardType.DvbT: cardName = String.Format("{0} DVB-T {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbT(cardName, dbsCard.IdCard), 1); break; case CardType.DvbC: cardName = String.Format("{0} DVB-C {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbC(cardName, dbsCard.IdCard), 1); break; case CardType.DvbS: cardName = String.Format("{0} DVB-S {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbS(cardName, dbsCard.IdCard), 1); break; case CardType.Atsc: cardName = String.Format("{0} ATSC {1}", cardId, cardName); AddChildSection(cardPage, new CardAtsc(cardName, dbsCard.IdCard), 1); break; case CardType.DvbIP: cardName = String.Format("{0} DVB-IP {1}", cardId, cardName); AddChildSection(cardPage, new CardDvbIP(cardName, dbsCard.IdCard), 1); break; case CardType.RadioWebStream: cardName = String.Format("{0} {1}", cardId, cardName); InfoPage RadioWebStreamInfo = new InfoPage(cardName); RadioWebStreamInfo.InfoText = "The RadioWebStream card does not have any options.\n\n\nYou can add your favourite radio webstreams under:\n\n --> 'Radio Channels', 'Add', 'Web-Stream' or by importing a playlist."; AddChildSection(cardPage, RadioWebStreamInfo, 1); break; case CardType.Unknown: cardName = String.Format("{0} Unknown {1}", cardId, cardName); AddChildSection(cardPage, new CardAnalog(cardName, dbsCard.IdCard), 1); break; } } } if (isLocal) { Utils.CheckForDvbHotfix(); } if (reloaded) { SectionTreeNode activeNode = (SectionTreeNode)settingSections[server.HostName]; if (activeNode != null) { activeNode.Expand(); } } } }
public SpellbookSpellsViewModel(PlayerViewModel model, SpellcastingFeature spellcastingFeature) : base(model, spellcastingFeature) { Title = spellcastingFeature.DisplayName; if (Title == null || Title == "") { Title = SpellcastingID; } Spellcasting = Model.Context.Player.GetSpellcasting(SpellcastingID); OnHighlight = new Command((par) => { Model.MakeHistory("Highlight"); Spellcasting.Highlight = (par as SpellViewModel)?.Name; foreach (SpellViewModel s in Spells) { s.IsHightlighted = false; } if (par is SpellViewModel svm) { svm.IsHightlighted = true; } OnPropertyChanged("Highlight"); Model.Save(); }); RemoveHighlight = new Command(() => { Model.MakeHistory("Highlight"); Spellcasting.Highlight = null; foreach (SpellViewModel s in Spells) { s.IsHightlighted = false; } OnPropertyChanged("Highlight"); Model.Save(); }); OnReduce = new Command((par) => { if (par is SpellSlotInfo s && s.Used < s.Slots) { if (last == s.Level) { s.Used++; Model.MakeHistory(s.SpellcastingID + "Slots" + s.Level); Model.Context.Player.SetSpellSlot(s.SpellcastingID, s.Level, s.Used); Model.Save(); (s as SpellSlotViewModel)?.UpdateUsed(); if (selected == s) { used = s.Used; OnPropertyChanged("Used"); } Model.UpdateSlots(this); } last = s.Level; } }); OnReset = new Command((par) => { if (par is SpellSlotInfo s) { s.Used = 0; Model.MakeHistory(s.SpellcastingID + "Slots" + s.Level); Model.Context.Player.SetSpellSlot(s.SpellcastingID, s.Level, s.Used); Model.Save(); (s as SpellSlotViewModel)?.UpdateUsed(); if (selected == s) { used = s.Used; OnPropertyChanged("Used"); } Model.UpdateSlots(this); } }); ResetAll = new Command(() => { IsBusy = true; Model.MakeHistory(); Model.Context.Player.ResetSpellSlots(SpellcastingID); Model.Save(); UpdateSlots(); used = 0; OnPropertyChanged("Used"); Model.UpdateSlots(this); IsBusy = false; }); ShowInfo = new Command(async(par) => { if (par is SpellViewModel svm) { if (svm.Spell is ModifiedSpell ms) { ms.Info = Model.Context.Player.GetAttack(ms, ms.differentAbility == OGL.Base.Ability.None ? SpellcastingFeature.SpellcastingAbility : ms.differentAbility); ms.Modifikations.AddRange(from f in Model.Context.Player.GetFeatures() where f is SpellModifyFeature && Utils.Matches(Model.Context, ms, ((SpellModifyFeature)f).Spells, null) select f); ms.Modifikations = ms.Modifikations.Distinct().ToList(); } await Navigation.PushAsync(InfoPage.Show(svm.Spell)); } }); spells = new List <SpellViewModel>(); spells.AddRange(from s in Spellcasting.GetLearned(Model.Context.Player, Model.Context) select new SpellViewModel(s) { Highlight = OnHighlight, ShowInfo = ShowInfo, AddAlwaysPreparedToName = false }); spells.AddRange(from s in Spellcasting.GetPrepared(Model.Context.Player, Model.Context) select new SpellViewModel(s) { Highlight = OnHighlight, ShowInfo = ShowInfo, AddAlwaysPreparedToName = false }); spells.Sort(); if (SpellcastingFeature.Preparation == OGL.Base.PreparationMode.ClassList) { spells.AddRange(from s in Spellcasting.GetCLassListRituals(SpellcastingFeature.PrepareableSpells ?? "false", Model.Context.Player, Model.Context) select new SpellViewModel(s) { Highlight = OnHighlight, ShowInfo = ShowInfo, AddAlwaysPreparedToName = false }); } else if (SpellcastingFeature.Preparation == OGL.Base.PreparationMode.Spellbook) { spells.AddRange(from s in Spellcasting.GetSpellbookRituals(Model.Context.Player, Model.Context) select new SpellViewModel(s) { Highlight = OnHighlight, ShowInfo = ShowInfo, AddAlwaysPreparedToName = false }); } UpdateSlots(); UpdateSpells(); }
public async Task Navigate <TViewModel>(TViewModel viewModel) { Page page = null; bool modal = false; if (typeof(TViewModel) == typeof(AddTeamViewModel)) { page = new AddTeamPage(); modal = true; } else if (typeof(TViewModel) == typeof(MainViewModel)) { page = new MainPage(); } else if (typeof(TViewModel) == typeof(AddVehicleViewModel)) { page = new AddVehiclePage(); modal = true; } else if (typeof(TViewModel) == typeof(AddWeaponViewModel)) { page = new AddWeaponPage(); modal = true; } else if (typeof(TViewModel) == typeof(AddUpgradeViewModel)) { page = new AddUpgradePage(); modal = true; } else if (typeof(TViewModel) == typeof(AddPerkViewModel)) { page = new AddPerkPage(); modal = true; } else if (typeof(TViewModel) == typeof(SelectSponsorViewModel)) { page = new SelectSponsorPage(); modal = true; } else if (typeof(TViewModel) == typeof(SelectVehicleViewModel)) { page = new SelectVehiclePage(); modal = true; } else if (typeof(TViewModel) == typeof(AddTrailerViewModel)) { page = new AddTrailerPage(); modal = true; } else if (typeof(TViewModel) == typeof(InfoViewModel)) { page = new InfoPage(); modal = true; } else { return; } page.BindingContext = viewModel; var nav = Application.Current.MainPage as NavigationPage; var current = nav?.CurrentPage; if (page is MainPage) { nav = new NavigationPage(page) { BarBackgroundColor = Color.FromHex("#2196F3"), BarTextColor = Color.White }; Application.Current.MainPage = nav; } else { var modalNav = nav.Navigation.ModalStack.FirstOrDefault() as NavigationPage; if (modalNav == null) { modalNav = new NavigationPage(page) { BarBackgroundColor = Color.FromHex("#2196F3"), BarTextColor = Color.White }; await nav.Navigation.PushModalAsync(modalNav); } else { await modalNav.Navigation.PushAsync(page); } } }
private void MainForm_Load(object sender, EventArgs e) { try { #region 测试版 #if DEBUG try { var apiHelper = new ApiHelper(); DateTime now = apiHelper.GetDate(DateType.SysDate); if (now > AboutBox.PublishDate.AddMonths(1)) //发布一个月失效 { SplashScreen.CloseSplashScreen(); MsgBox.ShowErrorMessage("该测试版已失效,请下在最新版!"); OpenIE(Config.ProxyHeroCloudSetting.UpdateUrl); Exit_Click(Exit, new EventArgs()); } } catch (WebException) { Config.InitErrorInfo = Config.LocalLanguage.Messages.InitializeFailed + "," + Config.LocalLanguage.Messages.PleaseCheckNetworkSettingsAreCorrect; } #endif #endregion #region _languageLoader = new LanguageLoader(); TimerAutoSwitchingProxy = new Timer(); TimerAutoChangeIcon = new Timer(); //SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.InitializeDatabase); //Config.InitDatabase(); _deserializeDockContent = GetContentFromPersistString; SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.LoadingLanguages); Config.LanguageFileName = Config.LocalSetting.LanguageFileName; if (System.IO.File.Exists(Config.LanguageFileName)) { Config.LocalLanguage = XmlHelper.XmlDeserialize( Config.LanguageFileName, typeof(Language)) as Language; } LoadLanguage(); #endregion #region 初始化配置 GetNetConfigAndCheckVersion(); #endregion #region 连接云引擎 try { DelegateVoid dv = ConnectCloud; var thred = new Thread(new ThreadStart(dv)); thred.Start(); } catch { if (Config.LocalLanguage != null) { CloudStatus.Text = Config.LocalLanguage.Messages.ConnectCloudEngineFailed; } CloudStatus.Image = Resources.cloudno; } #endregion #region Hotkey //Hotkey hotkey = new Hotkey(this.Handle); //Hotkey1 = hotkey.RegisterHotkey(System.Windows.Forms.Keys.T, Hotkey.KeyFlags.MOD_CONTROL); //hotkey.OnHotkey += new HotkeyEventHandler(OnHotkey); #endregion #region UI MainToolbar.Visible = false; MainStatusBar.Items.Insert(2, new ToolStripSeparator()); MainStatusBar.Items.Insert(4, new ToolStripSeparator()); MainStatusBar.Items.Insert(6, new ToolStripSeparator()); MainStatusBar.Items.Insert(8, new ToolStripSeparator()); MainStatusBar.Items.Insert(10, new ToolStripSeparator()); tsslVersion.Text = @"Version:" + Assembly.GetExecutingAssembly().GetName().Version; if (Config.LocalLanguage != null) { CloudStatus.Text = Config.LocalLanguage.Messages.ConnectingCloudEngine; } _httpHelper.HttpOption.Timeout = 60 * 1000; SetProxyStatusLabel(); if (Config.LocalLanguage != null) { AutoSwitchProxyStatus.Text = Config.LocalLanguage.Messages.AutomaticSwitchingOff; } Status.Text = Config.InitErrorInfo; Status.Spring = true; #endregion #region timer TimerAutoSwitchingProxy.Enabled = false; TimerAutoSwitchingProxy.Interval = 1000; TimerAutoSwitchingProxy.Elapsed += timerAutoSwitchingProxy_Elapsed; TimerAutoChangeIcon.Enabled = false; TimerAutoChangeIcon.Interval = 1000; TimerAutoChangeIcon.Elapsed += timerAutoChangeIcon_Elapsed; #endregion #region DockPanel if (Config.LocalLanguage != null) { SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.InitializeDockPanel); if (System.IO.File.Exists(Config.DockSettingFileName)) { try { MainDockPanel.LoadFromXml(Config.DockSettingFileName, _deserializeDockContent); } catch { _hasDockSettingExceptioin = true; if (System.IO.File.Exists(Config.DockSettingFileName)) { SplashScreen.CloseSplashScreen(); System.IO.File.Delete(Config.DockSettingFileName); MsgBox.ShowErrorMessage(Config.LocalLanguage.Messages.InitializeFailed); Application.Exit(); } } } else { #region dock StartPage.Show(MainDockPanel, DockState.Document); InfoPage.Show(MainDockPanel, DockState.DockBottomAutoHide); InfoPage.Hide(); ProxyPage.Show(MainDockPanel, DockState.Document); #endregion } } #endregion #region LoadViewSetting(); if (Config.LocalLanguage != null) { SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.CheckUpdate); } CheckVersionAndDownLoad(); #region 读取上次代理 if (System.IO.File.Exists(Config.LastProxyFileName)) { ProxyData.ProxyList = (List <ProxyServer>) XmlHelper.XmlDeserialize(Config.LastProxyFileName, typeof(List <ProxyServer>)); ProxyPage.BindData(); } #endregion if (Config.LocalLanguage != null) { SplashScreen.UpdateStatusText(Config.LocalLanguage.Messages.LoadingPlugins); } PluginManager.LoadAllPlugins(); //如果没有获取代理网页列表,则禁止使用 #if !DEBUG if (Config.ProxySiteUrlList.Count == 0) { this.ProxyPage.Enabled = false; } #endif SplashScreen.CloseSplashScreen(); StartPage.Activate(); Activate(); if (Config.ProxyHeroCloudSetting.EnableCommercialPage == "1") //如果显示弹出广告 { #if !DEBUG if (Config.IsChineseOs) { this.OpenNewTab(Config.ProxyHeroCloudSetting.CommercialUrl); } else { this.OpenNewTab(Config.ProxyHeroCloudSetting.EnglishCommercialUrl); } #else OpenNewTab(Config.IsChineseLanguage ? Config.ProxyHeroCloudSetting.CommercialUrl : Config.ProxyHeroCloudSetting.EnglishCommercialUrl); #endif } #endregion } catch (Exception ex) { SplashScreen.CloseSplashScreen(); MsgBox.ShowExceptionMessage(ex); } }
private static string GetValueForName(string text, string nameField) { return(InfoPage.GetDatafromText(text, "" + nameField + "=\"(.+?)\"", 1)); }
public void ShowInfoPage() { InfoPage.Show(); }
public SpellChoiceViewModel(PlayerModel model, SpellcastingFeature spellcasting, SpellChoiceFeature choice) : base(model, spellcasting, (spellcasting.DisplayName ?? spellcasting.SpellcastingID) + " - " + choice?.Name ?? choice?.UniqueID ?? "Additional") { Choice = choice; OnPrepare = new Command((par) => { if (par is SpellViewModel svm && SpellcastingFeature != null && Choice != null) { if (!svm.Prepared) { if (Count < Able) { svm.Prepared = true; Model.MakeHistory(); Model.Context.Player.GetSpellChoice(SpellcastingID, UniqueID).Choices.Add(svm.Name + " " + ConfigManager.SourceSeperator + " " + svm.Source); Model.Save(); } } else { svm.Prepared = false; Model.MakeHistory(); string r = svm.Name + " " + ConfigManager.SourceSeperator + " " + svm.Source; Model.Context.Player.GetSpellChoice(SpellcastingID, UniqueID).Choices.RemoveAll(s => ConfigManager.SourceInvariantComparer.Equals(s, r)); Model.Save(); if (svm.BadChoice) { Spells.Remove(svm); } if (svm.BadChoice) { spells.Remove(svm); } } OnPropertyChanged("Count"); OnPropertyChanged("Prepared"); ChangedSelectedSpells(SpellcastingID); } }, (par) => par is SpellViewModel svm && choice != null); ShowInfo = new Command(async(par) => { if (par is SpellViewModel svm) { if (svm.Spell is ModifiedSpell ms) { ms.Info = Model.Context.Player.GetAttack(ms, ms.differentAbility == Ability.None ? SpellcastingFeature.SpellcastingAbility : ms.differentAbility); ms.Modifikations.AddRange(from f in Model.Context.Player.GetFeatures() where f is SpellModifyFeature && Utils.Matches(Model.Context, ms, ((SpellModifyFeature)f).Spells, null) select f); ms.Modifikations = ms.Modifikations.Distinct().ToList(); } await Navigation.PushAsync(InfoPage.Show(svm.Spell)); } }); ResetPrepared = new Command(() => { IsBusy = true; Model.MakeHistory(); Model.Context.Player.GetSpellChoice(SpellcastingID, UniqueID).Choices.Clear(); Model.Save(); foreach (SpellViewModel s in spells) { s.Prepared = false; } spells.RemoveAll(s => s.BadChoice); UpdateSpells(); OnPropertyChanged("Count"); OnPropertyChanged("Selected"); ChangedSelectedSpells(SpellcastingID); IsBusy = false; }); AddSpells(); }
public SpellPrepareViewModel(PlayerModel model, SpellcastingFeature spellcasting) : base(model, spellcasting, "Prepare " + (spellcasting.DisplayName ?? spellcasting.SpellcastingID) + " Spells") { Image = ImageSource.FromResource("CB_5e.images.prepare.png"); Spellcasting = Model.Context.Player.GetSpellcasting(SpellcastingID); OnPrepare = new Command((par) => { if (par is SpellViewModel svm && SpellcastingFeature != null && !svm.AddAlwaysPreparedToName) { if (!svm.Prepared) { if (Count < Able) { svm.Prepared = true; Model.MakeHistory(); Spellcasting.GetPreparedList(Model.Context.Player, Model.Context).Add(svm.Name + " " + ConfigManager.SourceSeperator + " " + svm.Source); Model.Save(); } } else { svm.Prepared = false; Model.MakeHistory(); string r = svm.Name + " " + ConfigManager.SourceSeperator + " " + svm.Source; Spellcasting.GetPreparedList(Model.Context.Player, Model.Context).RemoveAll(s => ConfigManager.SourceInvariantComparer.Equals(s, r)); Model.Save(); if (svm.BadChoice) { Spells.Remove(svm); } if (svm.BadChoice) { spells.Remove(svm); } } OnPropertyChanged("Count"); OnPropertyChanged("Prepared"); (model as PlayerViewModel)?.ChangedPreparedSpells(SpellcastingID); } }, (par) => par is SpellViewModel svm && !svm.AddAlwaysPreparedToName); ShowInfo = new Command(async(par) => { if (par is SpellViewModel svm) { if (svm.Spell is ModifiedSpell ms) { ms.Info = Model.Context.Player.GetAttack(ms, ms.differentAbility == Ability.None ? SpellcastingFeature.SpellcastingAbility : ms.differentAbility); ms.Modifikations.AddRange(from f in Model.Context.Player.GetFeatures() where f is SpellModifyFeature && Utils.Matches(Model.Context, ms, ((SpellModifyFeature)f).Spells, null) select f); ms.Modifikations = ms.Modifikations.Distinct().ToList(); } await Navigation.PushAsync(InfoPage.Show(svm.Spell)); } }); ResetPrepared = new Command(() => { IsBusy = true; Model.MakeHistory(); Spellcasting.GetPreparedList(Model.Context.Player, Model.Context).Clear(); Model.Save(); foreach (SpellViewModel s in spells) { s.Prepared = s.AddAlwaysPreparedToName; } spells.RemoveAll(s => s.BadChoice); UpdateSpells(); OnPropertyChanged("Count"); OnPropertyChanged("Prepared"); (model as PlayerViewModel)?.ChangedPreparedSpells(SpellcastingID); IsBusy = false; }); AddSpells(); }