コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Configuration"/> class. Uses the passed
 /// configuration storage to populate its settings.
 /// </summary>
 /// <param name="storage">The storage to use for settings.</param>
 /// <param name="deviceInfo">Information about device</param>
 public Configuration(IConfigurationStorage storage, MobileDeviceInfo deviceInfo)
 {
     Storage                       = storage;
     DeviceInfo                    = deviceInfo;
     Metadata                      = new Metadata();
     BeforeNotifyCallbacks         = new List <Func <Event, bool> >();
     InternalBeforeNotifyCallbacks = new List <Action <Event> >();
 }
コード例 #2
0
        /// <summary>
        /// Initializes this configuration control with the specified <see cref="PluginConfigurationData" />.
        /// </summary>
        /// <param name="configuration">The configuration data.</param>
        /// <param name="environment">Information about the plugin environment.</param>
        public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
        {
            _activityData            = configuration.GetMetadata <HpRoamActivityData>();
            _pluginConfigurationData = configuration;

            _mobileAsset = ConfigurationServices.AssetInventory.GetAssets(_pluginConfigurationData.Assets.SelectedAssets).FirstOrDefault(n => n.Attributes.HasFlag(AssetAttributes.Mobile)) as MobileDeviceInfo;

            if (_mobileAsset != null)
            {
                _pluginConfigurationData.Assets.SelectedAssets.Remove(_mobileAsset.AssetId);
            }

            assetSelectionControl.Initialize(_pluginConfigurationData.Assets, AssetAttributes.None);
            documentSelectionControl.Initialize(configuration.Documents);
            lockTimeoutControl.Initialize(_activityData.LockTimeouts);
            SetConfiguration();
        }
コード例 #3
0
 private void Button_PhoneSelect_Click(object sender, EventArgs e)
 {
     using (AssetSelectionForm assetSelectionForm = new AssetSelectionForm(AssetAttributes.Mobile, textBox_PhoneId.Text, false))
     {
         assetSelectionForm.ShowDialog(this);
         if (assetSelectionForm.DialogResult == DialogResult.OK)
         {
             _mobileAsset = (MobileDeviceInfo)assetSelectionForm.SelectedAssets.FirstOrDefault();
             if (_mobileAsset != null)
             {
                 textBox_AssetId.Text     = _mobileAsset.AssetId;
                 textBox_Description.Text = _mobileAsset.Description;
                 textBox_PhoneId.Text     = _mobileAsset.MobileEquipmentId;
             }
         }
     }
 }
コード例 #4
0
ファイル: Client.cs プロジェクト: gerasimov-a/Bugsnager.Net
        /// <summary>
        /// Initialize the client with dependencies
        /// </summary>
        /// <param name="configStorage">The configuration to use</param>
        /// <param name="deviceInfo">Information about device</param>
        protected void Initialize(IConfigurationStorage configStorage, MobileDeviceInfo deviceInfo = null)
        {
            if (configStorage == null || string.IsNullOrEmpty(configStorage.ApiKey) || !_apiRegex.IsMatch(configStorage.ApiKey))
            {
                Logger.Error("You must provide a valid Bugsnag API key");
                throw new ArgumentException("You must provide a valid Bugsnag API key");
            }
            else
            {
                Config   = new Configuration(configStorage, deviceInfo);
                Notifier = new Notifier(Config);

                // Install a default exception handler with this client
                if (Config.AutoNotify)
                {
                    StartAutoNotify();
                }

                Initialized();
            }
        }
コード例 #5
0
        /// <summary>
        /// Retrieves <see cref="AssetInfo" /> for all assets in the inventory.
        /// </summary>
        /// <returns><see cref="AssetInfo" /> for all assets in the inventory.</returns>
        public AssetInfoCollection GetAssets()
        {
            List <AssetInfo> assets = new List <AssetInfo>();

            DatabaseQuery(Resources.SelectPrinters, record =>
            {
                PrintDeviceInfoInternal deviceInfo = new PrintDeviceInfoInternal
                                                     (
                    (string)record["AssetId"],
                    (AssetAttributes)record["Attributes"],
                    record["PrinterType"] as string,
                    record["Address"] as string,
                    record["Address2"] as string,
                    record["Password"] as string,
                    record["Product"] as string,
                    (int)record["PortNumber"],
                    (bool)record["SnmpEnabled"]
                                                     );

                deviceInfo.Description  = $"{deviceInfo.ProductName} ({(string)record["Model"]}) at {deviceInfo.Address}";
                deviceInfo.ModelName    = record["ModelName"] as string;
                deviceInfo.ModelNumber  = record["ModelNumber"] as string;
                deviceInfo.SerialNumber = record["SerialNumber"] as string;

                assets.Add(deviceInfo);
            });

            DatabaseQuery(Resources.SelectSimulators, record =>
            {
                DeviceSimulatorInfo deviceSimulatorInfo = new DeviceSimulatorInfo
                                                          (
                    (string)record["AssetId"],
                    (AssetAttributes)record["Attributes"],
                    "DeviceSimulator",
                    record["Address"] as string,
                    record["Password"] as string,
                    record["Product"] as string,
                    record["SimulatorType"] as string
                                                          );

                deviceSimulatorInfo.Description = $"{deviceSimulatorInfo.SimulatorType} device simulator at {deviceSimulatorInfo.Address}";
                assets.Add(deviceSimulatorInfo);
            });

            DatabaseQuery(Resources.SelectVirtualPrinters, record =>
            {
                VirtualPrinterInfo virtualPrinterInfo = new VirtualPrinterInfo
                                                        (
                    (string)record["AssetId"],
                    (AssetAttributes)record["Attributes"],
                    "VirtualPrinter",
                    record["Address"] as string,
                    9100,
                    false
                                                        );

                virtualPrinterInfo.Description = $"Virtual printer at {virtualPrinterInfo.Address}";
                assets.Add(virtualPrinterInfo);
            });

            DatabaseQuery(Resources.SelectMobileDevices, record =>
            {
                MobileDeviceInfo mobileDeviceInfo = new MobileDeviceInfo
                                                    (
                    (string)record["AssetId"],
                    (AssetAttributes)record["Attributes"],
                    "MobileDevice",
                    record["MobileEquipmentId"] as string,
                    EnumUtil.Parse <MobileDeviceType>(record["MobileDeviceType"] as string, true)
                                                    );

                mobileDeviceInfo.Description = record["Description"] as string;
                assets.Add(mobileDeviceInfo);
            });

            return(new AssetInfoCollection(assets));
        }
コード例 #6
0
ファイル: Client.cs プロジェクト: gerasimov-a/Bugsnager.Net
 public Client(IConfigurationStorage configStorage, MobileDeviceInfo deviceInfo)
 {
     Initialize(configStorage, deviceInfo);
 }