示例#1
0
 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));
示例#2
0
        internal static AppToken App(Application app)
        {
            Requires.NotNull(app, nameof(app));

            return(app.IsVisible()
                ? VisibleApp(app)
                : InvisibleApp(IdFactory.App(app)));
        }
示例#3
0
 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()));
 }
示例#4
0
 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()));
 }
示例#5
0
 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)));
 }
示例#6
0
        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));
        }