internal static AppToken VisibleApp(Application app) => new AppToken( id: IdFactory.App(app), isActive: app.IsActive(), isVisible: true, version: app.VersionName(), books: app.Workbooks.OfType <Workbook>().Select(Book));
internal static AppToken App(Application app) { Requires.NotNull(app, nameof(app)); return(app.IsVisible() ? VisibleApp(app) : InvisibleApp(IdFactory.App(app))); }
internal static SheetToken Sheet(Chart chart) { Requires.NotNull(chart, nameof(chart)); return(new SheetToken( id: IdFactory.Sheet(chart), isActive: chart.IsActive(), isVisible: chart.IsVisible(), index: chart.Index, tabColor: chart.TabColor())); }
internal static SheetToken Sheet(Worksheet sheet) { Requires.NotNull(sheet, nameof(sheet)); return(new SheetToken( id: IdFactory.Sheet(sheet), isActive: sheet.IsActive(), isVisible: sheet.IsVisible(), index: sheet.Index, tabColor: sheet.TabColor())); }
internal static BookToken Book(Workbook book) { Requires.NotNull(book, nameof(book)); return(new BookToken( id: IdFactory.Book(book), isActive: book.IsActive(), isVisible: book.IsVisible(), isAddIn: book.IsAddin, sheets: book.Sheets.OfType <object>().Select(Sheet), windows: book.Windows.OfType <Window>() .OrderBy(w => w.WindowNumber) .Select(Window))); }
internal static WindowToken Window(Window win) { Requires.NotNull(win, nameof(win)); object activeSheet = win.ActiveSheet; Debug.Assert(activeSheet != null); var activeSheetId = activeSheet != null?IdFactory.Sheet(activeSheet) : null; return(new WindowToken( id: IdFactory.Window(win), isActive: win.IsActive(), isVisible: win.Visible, state: ConvertState(win.WindowState), activeSheetId: activeSheetId)); }