private void ToggleDirection() { switch (++DirMode) { case 0: Bk.Entry.TextLayout = LayoutMethod.VerticalWriting | LayoutMethod.RightToLeft; break; case 1: Bk.Entry.TextLayout = LayoutMethod.VerticalWriting; break; case 2: Bk.Entry.TextLayout = 0; break; default: DirMode = 0; goto case 0; } Bk.SaveInfo(); SetDirection(); OnToggle?.Invoke(); }
private void AddOrRemoveFav(object sender, RoutedEventArgs e) { if (ThisBook.IsFav) { ThisBook.IsFav = false; } else { ThisBook.IsFav = true; } ThisBook.SaveInfo(); ToggleFav(); }
public void Load(BookItem b, bool useCache = false) { CurrentBook = b; if (b.IsLocal()) { OnComplete(b); } else if (b.IsSpider()) { Task.Run(() => LoadInstruction(( BookInstruction )b, useCache)); } else if (CurrentBook.IsEx()) { string BookId = b.ZItemId; string Mode = CurrentBook.XField <string>("Mode"); if (useCache && b.Info.Flags.Contains(Mode)) { OnComplete(b); } else { b.Info.Flags.Add(Mode); X.Instance <IRuntimeCache>(XProto.WRuntimeCache) .InitDownload( BookId, X.Call <XKey[]>(XProto.WRequest, "DoBookAction", Mode, BookId) , (e, id) => { CurrentBook.XCall("ParseXml", e.ResponseString); CurrentBook.LastCache = DateTime.Now; CurrentBook.SaveInfo(); OnComplete(CurrentBook); } , (cache, id, ex) => { b.Info.Flags.Remove(Mode); OnComplete(null); }, true ); } } }