private void addGoogleSpreadsheetReferenceToolStripMenuItem_Click(object sender, EventArgs e) { if (!GoogleAuthManager.CheckGoogleCredentials(this)) { return; } var zDialog = new GoogleSpreadsheetBrowser(GoogleReferenceReader.APP_NAME, GoogleReferenceReader.CLIENT_ID, CardMakerInstance.GoogleAccessToken, true); if (DialogResult.OK == zDialog.ShowDialog(this)) { var bNewDefault = 0 == treeView.SelectedNode.Nodes.Count; var zLayout = (ProjectLayout)treeView.SelectedNode.Tag; var tnReference = AddReferenceNode( treeView.SelectedNode, CardMakerConstants.GOOGLE_REFERENCE + CardMakerConstants.GOOGLE_REFERENCE_SPLIT_CHAR + zDialog.SelectedSpreadsheet.Title.Text + CardMakerConstants.GOOGLE_REFERENCE_SPLIT_CHAR + zDialog.SelectedSheet.Title.Text, bNewDefault, zLayout); if (null == tnReference) { MessageBox.Show(this, "The specified reference is already associated with this layout.", "Reference Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (bNewDefault) { tnReference.Parent.Expand(); LayoutManager.Instance.RefreshActiveLayout(); LayoutManager.Instance.FireLayoutUpdatedEvent(true); } ProjectManager.Instance.FireProjectUpdated(true); } }
private void addGoogleSpreadsheetReferenceToolStripMenuItem_Click(object sender, EventArgs e) { if (!GoogleAuthManager.CheckGoogleCredentials(this)) { return; } var zDialog = new GoogleSpreadsheetBrowser(new GoogleSpreadsheet(CardMakerInstance.GoogleInitializerFactory), true); if (DialogResult.OK == zDialog.ShowDialog(this)) { var zGoogleSpreadsheetReference = new GoogleSpreadsheetReference(zDialog.SelectedSpreadsheet) { SheetName = zDialog.SelectedSheet }; tryToAddReferenceNode(zGoogleSpreadsheetReference.generateFullReference()); } }
private void addGoogleSpreadsheetReferenceToolStripMenuItem_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(CardMakerInstance.GoogleAccessToken)) { if (DialogResult.Cancel == MessageBox.Show(this, "You do not appear to have any Google credentials configured. Press OK to configure.", "Google Credentials Missing", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { return; } GoogleAuthManager.Instance.FireGoogleAuthUpdateRequestedEvent(); return; } var zDialog = new GoogleSpreadsheetBrowser(GoogleReferenceReader.APP_NAME, GoogleReferenceReader.CLIENT_ID, CardMakerInstance.GoogleAccessToken, true); if (DialogResult.OK == zDialog.ShowDialog(this)) { var bNewDefault = 0 == treeView.SelectedNode.Nodes.Count; var zLayout = (ProjectLayout)treeView.SelectedNode.Tag; var tnReference = AddReferenceNode( treeView.SelectedNode, CardMakerConstants.GOOGLE_REFERENCE + CardMakerConstants.GOOGLE_REFERENCE_SPLIT_CHAR + zDialog.SelectedSpreadsheet.Title.Text + CardMakerConstants.GOOGLE_REFERENCE_SPLIT_CHAR + zDialog.SelectedSheet.Title.Text, bNewDefault, zLayout); if (null == tnReference) { MessageBox.Show(this, "The specified reference is already associated with this layout.", "Reference Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (bNewDefault) { tnReference.Parent.Expand(); LayoutManager.Instance.FireLayoutUpdatedEvent(true); } ProjectManager.Instance.FireProjectUpdated(true); } }