public AnimationPage() { this.InitializeComponent(); var link = this.Intent()["link"]; var tamdoc = TamUtils.getXMLAsset(this.Intent()["link"]); alltams = TamUtils.tamList(tamdoc).Where(t => t.attr("display") != "none"); animtot = alltams.Count(); animnum = int.Parse(this.Intent()["anim"]); Callouts.SetLevel(link); setAnimation(); Callouts.AnimationFinished = () => { PlayPath.Fill = new SolidColorBrush(Colors.Black); PausePath.Fill = new SolidColorBrush(Colors.Transparent); playing = false; }; ManipulationMode = ManipulationModes.TranslateX; ManipulationStarted += (x, e) => x1 = (int)e.Position.X; ManipulationCompleted += (x, e) => { x2 = (int)e.Position.X; if (x1 - x2 > animationView.ActualWidth / 2 && animnum + 1 < animtot) { // swipe left animnum++; setAnimation(); } else if (x2 - x1 > animationView.ActualWidth / 2 && animnum > 0) { // swipe right animnum--; setAnimation(); } }; }
public DefinitionPage() { this.InitializeComponent(); var link = this.Intent()["link"].ReplaceAll(@"\..*", "") + ".html"; Callouts.SetLevel(link); Uri url = webview.BuildLocalStreamUri("assets", link.ReplaceAll("ms/", "ms0/")); webview.NavigationCompleted += navigationCompleted; webview.NavigateToLocalStreamUri(url, this); // if (!Regex.Match(link, "^(b1|b2|ms0)").Success) // AbbrevFullPanel.Visibility = Visibility.Collapsed; Callouts.AnimationPart = async(int part) => { await webview.InvokeScriptAsync("eval", new string[] { $"setPart({part})" }); }; }
public void reset() { // Fetch the list of animations and build the table var prevtitle = ""; var prevgroup = ""; link = this.Intent()["link"]; Callouts.SetLevel(link); XmlDocument tamdoc = TamUtils.getXMLAsset(link); var title = tamdoc.SelectSingleNode("/tamination").attr("title"); Callouts.SetTitle(title); var tams = TamUtils.tamList(tamdoc); var diffsum = 0; var firstanim = -1; var i = 0; foreach (IXmlNode tam in tams) { if (tam.attr("display") == "none") { continue; } var tamtitle = tam.attr("title"); var from = TamUtils.tamXref(tam).attr("from"); var group = tam.attr("group"); var diffstr = TamUtils.tamXref(tam).attr("difficulty"); var diff = diffstr.Length > 0 ? int.Parse(diffstr) : 0; diffsum += diff; if (group.Length > 0) { // Add header for new group as needed if (group != prevgroup) { if (Regex.Match(group, @"^\s+$").Success) { // Blank group, for calls with no common starting phrase // Add a green separator unless it's the first group if (anims.Count > 0) { anims.Add(new AnimListItem() { celltype = CellType.Separator }); } } else { // Named group e.g. "As Couples.." // Add a header with the group name, which starts // each call in the group anims.Add(new AnimListItem() { celltype = CellType.Header, name = group }); } } from = tamtitle.Replace(group, " ").Trim(); } else if (tamtitle != prevtitle) { // Not a group but a different call // Put out a header with this call anims.Add(new AnimListItem() { celltype = CellType.Header, name = tamtitle + " from" }); } // Build list item for this animation prevtitle = tamtitle; prevgroup = group; // TODO posanim(av.getCount) = i // Remember where the first real animation is in the list if (firstanim < 0) { firstanim = anims.Count; } // TODO selectanim and weblink // ... // Put out a selectable item anims.Add(new AnimListItem() { celltype = Regex.Match(group, @"^\s+$").Success ? CellType.Plain : CellType.Indented, title = tamtitle, name = from, group = group.Length > 0 ? group : tamtitle + " from", animnumber = i, difficulty = diff }); i = i + 1; } if (diffsum <= 0) { DifficultyLegend.Visibility = Visibility.Collapsed; } AnimList.ItemsSource = anims; if (firstanim >= 0) { Callouts.FirstAnimationReady(anims[firstanim]); } }