public InMemoryTokenManager(int organizationId, Arena.Core.Lookup pcoAccount) { Arena.Organization.Organization organization = new Arena.Organization.Organization(organizationId); ConsumerKey = organization.Settings["PCO_Consumer_Token"] ?? DEFAULT_CONSUMER_TOKEN; ConsumerSecret = organization.Settings["PCO_Consumer_Secret"] ?? DEFAULT_CONSUMER_SECRET; if (pcoAccount != null) { string accessKey = pcoAccount.Qualifier; string accessSecret = pcoAccount.Qualifier8; if (accessKey != string.Empty && accessSecret != string.Empty) { TokenSecrets.Add(accessKey, accessSecret); } } }
private void RefreshMenu() { try { int organizationID = Int32.Parse(ArenaContext.Current.AppSettings["Organization"]); organization = new Arena.Organization.Organization(organizationID); // Load the scanner devices and set the default this.acquisition = new Acquisition(); if (this.acquisition.Devices.Count <= 0) { MessageBox.Show("There were not any scanners found. This application requires a scanner.", "No Scanner", MessageBoxButtons.OK, MessageBoxIcon.Stop); Application.Exit(); } this.acquisition.AsynchronousException += new AsynchronousExceptionEventHandler(this.acquisition_AsynchronousException); this.acquisition.AcquireFinished += new EventHandler(acquisition_AcquireFinished); this.acquisition.ImageAcquired += new ImageAcquiredEventHandler(acquisition_ImageAcquired); this.acquisition.AcquireCanceled += new EventHandler(acquisition_AcquireCanceled); this.acquisition.DeviceEvent += new DeviceEventHandler(acquisition_DeviceEvent); miScanner.DropDownItems.Clear(); foreach (Device twainDevice in this.acquisition.Devices) { ToolStripMenuItem miDevice = new ToolStripMenuItem(); miDevice.Text = twainDevice.Identity.ProductName; miDevice.Tag = twainDevice; miScanner.DropDownItems.Add(miDevice); if (twainDevice.Identity.ProductName == Properties.Settings.Default.DefaultScanner) { this.device = twainDevice; miDevice.Checked = true; } } if (this.device == null) { this.device = this.acquisition.Devices.Default; foreach (ToolStripItem item in miScanner.DropDownItems) { if (item.Text == this.device.Identity.ProductName) { ((ToolStripMenuItem)item).Checked = true; break; } } } // Load document types and set default miDocumentType.DropDownItems.Clear(); DocumentTypeCollection docTypes = new DocumentTypeCollection(); docTypes.LoadByOrganizationID(organizationID); int defaultDocType = Properties.Settings.Default.DefaultDocType; foreach (AttributeGroup attrGroup in new AttributeGroupCollection(organizationID)) { foreach (Arena.Core.Attribute attr in attrGroup.Attributes) { if (attr.AttributeType == Arena.Enums.DataType.Document && attr.TypeQualifier.Trim() != string.Empty) { try { DocumentType docType = new DocumentType(Int32.Parse(attr.TypeQualifier)); if (defaultDocType == 0) { defaultDocType = docType.DocumentTypeId; } ToolStripMenuItem miDocument = new ToolStripMenuItem(); miDocument.Text = docType.TypeName; miDocument.Tag = new myDocType(docType, attr.AttributeId); miDocument.Checked = (docType.DocumentTypeId == defaultDocType); miDocumentType.DropDownItems.Add(miDocument); } catch { } } } } for (int i = 0; i < miPageSize.DropDownItems.Count; i++) { ((ToolStripMenuItem)miPageSize.DropDownItems[i]).Checked = (i == Properties.Settings.Default.DefaultPageSize); } for (int i = 0; i < miRotation.DropDownItems.Count; i++) { ((ToolStripMenuItem)miRotation.DropDownItems[i]).Checked = (i == Properties.Settings.Default.DefaultRotate); } UpdateStatus(); } catch (System.Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }