Beispiel #1
0
        private void googleSheetsInterfaceSetup()
        {
            // not run if the target isn't set up within the program
            if (m_foundGoogleSheetAndTab == false)
            {
                return;
            }

            PrefsData.PrefLogIndex index = m_userPrefs.getActiveSheet();

            string googleSheetsId = m_userPrefs.getLogGoogleId(index);
            string tabName        = m_userPrefs.getProjectName(index);

            if (googleSheetsId == "" || tabName == "")
            {
                DialogMessage message = new DialogMessage("Information", "A Google Sheets id and tab name must be set in order to use google sheets interface.\nInteraction with google sheet will not function.");
                message.ShowDialog();
                return;
            }

            // check wth google sheets to see if the tab needs to be created
            if (!TCOSheetsInterface.tabExists(m_userPrefs.getLogGoogleId(index), m_userPrefs.getProjectName(index)))
            {
                System.Drawing.Size size = new System.Drawing.Size(5, 2);
                if (!TCOSheetsInterface.createTab(m_userPrefs.getLogGoogleId(index), m_userPrefs.getProjectName(index), size, 1))
                {
                    Console.WriteLine("Create new tab [" + m_userPrefs.getProjectName(index) + "] failed");
                }

                // create the header bar in the created tab
                SheetsLogEntry entryMaker = new SheetsLogEntry();
                List <Google.Apis.Sheets.v4.Data.RowData> rows = entryMaker.createTitleBar();
                TCOSheetsInterface.updateCells(
                    m_userPrefs.getLogGoogleId(index),
                    m_userPrefs.getProjectName(index),
                    "A1", "E2", rows);
            }
        }