private void GeocodeAddress(IPropertySet addressProperties) { // Match the Address IAddressGeocoding addressGeocoding = m_locator as IAddressGeocoding; IPropertySet resultSet = addressGeocoding.MatchAddress(addressProperties); // Print out the results object names, values; resultSet.GetAllProperties(out names, out values); string[] namesArray = names as string[]; object[] valuesArray = values as object[]; int length = namesArray.Length; IPoint point = null; for (int i = 0; i < length; i++) { if (namesArray[i] != "Shape") this.ResultsTextBox.Text += namesArray[i] + ": " + valuesArray[i].ToString() + "\n"; else { if (point != null && !point.IsEmpty) { point = valuesArray[i] as IPoint; this.ResultsTextBox.Text += "X: " + point.X + "\n"; this.ResultsTextBox.Text += "Y: " + point.Y + "\n"; } } } this.ResultsTextBox.Text += "\n"; }
public MainPage() { InitializeComponent(); appSettings = ApplicationData.Current.LocalSettings.Values; ResetButton.Visibility = Visibility.Collapsed; Loaded += MainPage_Loaded; }
public MainPage() { this.InitializeComponent(); appSettings = ApplicationData.Current.RoamingSettings.Values; _current = this; }
internal static byte[] GetCacheValue(IPropertySet containerValues) { if (!containerValues.ContainsKey(CacheValueLength)) { return null; } int encyptedValueLength = (int)containerValues[CacheValueLength]; int segmentCount = (int)containerValues[CacheValueSegmentCount]; byte[] encryptedValue = new byte[encyptedValueLength]; if (segmentCount == 1) { encryptedValue = (byte[])containerValues[CacheValue + 0]; } else { for (int i = 0; i < segmentCount - 1; i++) { Array.Copy((byte[])containerValues[CacheValue + i], 0, encryptedValue, i * MaxCompositeValueLength, MaxCompositeValueLength); } } Array.Copy((byte[])containerValues[CacheValue + (segmentCount - 1)], 0, encryptedValue, (segmentCount - 1) * MaxCompositeValueLength, encyptedValueLength - (segmentCount - 1) * MaxCompositeValueLength); return CryptographyHelper.Decrypt(encryptedValue); }
public void Construct(IPropertySet props) { configProps = props; String connString = "Data Source=WCMC-GIS-03\\SQL2008WEB;Initial Catalog='csn';User Id=sde;Password=conserveworld;"; sqlConn = new SqlConnection(connString); sqlConn.Open(); }
internal static void SetCacheValue(IPropertySet containerValues, byte[] value) { byte[] encryptedValue = CryptographyHelper.Encrypt(value); containerValues[CacheValueLength] = encryptedValue.Length; if (encryptedValue == null) { containerValues[CacheValueSegmentCount] = 1; containerValues[CacheValue + 0] = null; } else { int segmentCount = (encryptedValue.Length / MaxCompositeValueLength) + ((encryptedValue.Length % MaxCompositeValueLength == 0) ? 0 : 1); byte[] subValue = new byte[MaxCompositeValueLength]; for (int i = 0; i < segmentCount - 1; i++) { Array.Copy(encryptedValue, i * MaxCompositeValueLength, subValue, 0, MaxCompositeValueLength); containerValues[CacheValue + i] = subValue; } int copiedLength = (segmentCount - 1) * MaxCompositeValueLength; Array.Copy(encryptedValue, copiedLength, subValue, 0, encryptedValue.Length - copiedLength); containerValues[CacheValue + (segmentCount - 1)] = subValue; containerValues[CacheValueSegmentCount] = segmentCount; } }
internal protected virtual void Read (IPropertySet pset) { properties = pset; intermediateOutputDirectory = pset.GetPathValue ("IntermediateOutputPath"); outputDirectory = pset.GetPathValue ("OutputPath", defaultValue:"." + Path.DirectorySeparatorChar); debugMode = pset.GetValue<bool> ("DebugSymbols", false); pauseConsoleOutput = pset.GetValue ("ConsolePause", true); if (pset.HasProperty ("Externalconsole")) {//for backward compatiblity before version 6.0 it was lowercase writeExternalConsoleLowercase = true; externalConsole = pset.GetValue<bool> ("Externalconsole"); } else { writeExternalConsoleLowercase = false; externalConsole = pset.GetValue<bool> ("ExternalConsole"); } commandLineParameters = pset.GetValue ("Commandlineparameters", ""); runWithWarnings = pset.GetValue ("RunWithWarnings", true); // Special case: when DebugType=none, xbuild returns an empty string debugType = pset.GetValue ("DebugType"); if (string.IsNullOrEmpty (debugType)) { debugType = "none"; debugTypeReadAsEmpty = true; } debugTypeWasNone = debugType == "none"; var svars = pset.GetValue ("EnvironmentVariables"); ParseEnvironmentVariables (svars, environmentVariables); // Kep a clone of the loaded env vars, so we can check if they have changed when saving loadedEnvironmentVariables = new Dictionary<string, string> (environmentVariables); pset.ReadObjectProperties (this, GetType (), true); }
/// <summary> Copy the contents of one propertyset into another. /// </summary> /// <param name="src">The propertyset to copy from. /// </param> /// <param name="dest">The propertyset to copy into. /// /// </param> public static void Clone(IPropertySet src, IPropertySet dest) { PropertySetCloner cloner = new PropertySetCloner(); cloner.Source = src; cloner.Destination = dest; cloner.cloneProperties(); }
public void Construct(IPropertySet props) { const string methodName = "Construct"; configProps = props; logger.LogMessage(ServerLogger.msgType.debug, methodName, 9999, "firing!"); try { // Initialize our logger. Creates the folder and file if it doesn't already exist. _dtsLogger = new ComLogUtil(); _dtsLogger.FileName = soe_name + "_Log.txt"; _dtsLogger.LogInfo(soe_name, methodName, "DTSAgile logger initialized."); // Set the root cache directory the tiles should be written to // TODO: Do we want the root location to be configurable?? var rootDir = @"C:\arcgis\" + soe_name; _vectorCacheRootDirectory = System.IO.Path.Combine(rootDir, this.CreateMapServiceCacheFolderName()); this.ValidateMapServiceSpatialReference(); } catch (Exception ex) { _dtsLogger.LogError(soe_name, methodName, "none", ex); logger.LogMessage(ServerLogger.msgType.error, methodName, 9999, "Failed to get ServerObject::ConfigurationName"); } }
/// <summary> /// Creates the property value map. /// </summary> /// <param name="props"> The props. </param> /// <returns> </returns> public Dictionary<MonthTypeContainer, string> CreatePropertyValueMap(IPropertySet props) { return new Dictionary<MonthTypeContainer, string> { {new MonthTypeContainer("January", "Duration"), "DUR1"}, {new MonthTypeContainer("February", "Duration"), "DUR2"}, {new MonthTypeContainer("March", "Duration"), "DUR3"}, {new MonthTypeContainer("April", "Duration"), "DUR4"}, {new MonthTypeContainer("May", "Duration"), "DUR5"}, {new MonthTypeContainer("June", "Duration"), "DUR6"}, {new MonthTypeContainer("July", "Duration"), "DUR7"}, {new MonthTypeContainer("August", "Duration"), "DUR8"}, {new MonthTypeContainer("September", "Duration"), "DUR9"}, {new MonthTypeContainer("October", "Duration"), "DUR10"}, {new MonthTypeContainer("November", "Duration"), "DUR11"}, {new MonthTypeContainer("December", "Duration"), "DUR12"}, {new MonthTypeContainer("January", "Radiation"), "SOL1"}, {new MonthTypeContainer("February", "Radiation"), "SOL2"}, {new MonthTypeContainer("March", "Radiation"), "SOL3"}, {new MonthTypeContainer("April", "Radiation"), "SOL4"}, {new MonthTypeContainer("May", "Radiation"), "SOL5"}, {new MonthTypeContainer("June", "Radiation"), "SOL6"}, {new MonthTypeContainer("July", "Radiation"), "SOL7"}, {new MonthTypeContainer("August", "Radiation"), "SOL8"}, {new MonthTypeContainer("September", "Radiation"), "SOL9"}, {new MonthTypeContainer("October", "Radiation"), "SOL10"}, {new MonthTypeContainer("November", "Radiation"), "SOL11"}, {new MonthTypeContainer("December", "Radiation"), "SOL12"}, {new MonthTypeContainer("Annual", "Duration"), "DURANN"} }; }
public static IWorkspace GetWorkspaceSDEFromConnectionPropertySet(IPropertySet propertySet) { if (propertySet == null) throw new ArgumentNullException("propertySet"); String connectionProperties = null; try { // for error reference - convert to string connectionProperties = PropertySetToString(propertySet); var factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory"); var workspaceFactory = (IWorkspaceFactory2)Activator.CreateInstance(factoryType); // Enable Schema Cache IWorkspaceFactorySchemaCache workspaceFactorySchemaCache = (IWorkspaceFactorySchemaCache)workspaceFactory; workspaceFactorySchemaCache.EnableSchemaCaching(); return workspaceFactory.Open(propertySet, 0); } catch (Exception ex) { throw new Exception( String.Format("Failed to Open SDE Workspace from connection properties [{0}]", connectionProperties), ex); } }
public ExtensionLite(AppExtension ext, IPropertySet properties) : this() { AppExtension = ext; _valueset = properties; AppExtensionUniqueId = ext.AppInfo.AppUserModelId + "!" + ext.Id; Manifest = new ExtensionManifest(); Manifest.AppExtensionUniqueID = AppExtensionUniqueId; foreach (var prop in properties) { switch (prop.Key) { case "Title": Manifest.Title = GetValueFromProperty(prop.Value); break; case "IconUrl": Manifest.IconUrl = GetValueFromProperty(prop.Value); break; case "Publisher": Manifest.Publisher = GetValueFromProperty(prop.Value); break; case "Version": Manifest.Version = GetValueFromProperty(prop.Value); break; case "Abstract": Manifest.Abstract = GetValueFromProperty(prop.Value); break; case "FoundInToolbarPositions": Manifest.FoundInToolbarPositions = (ExtensionInToolbarPositions)Enum.Parse(typeof(ExtensionInToolbarPositions), GetValueFromProperty(prop.Value)); break; case "LaunchInDockPositions": Manifest.LaunchInDockPositions = (ExtensionInToolbarPositions)Enum.Parse(typeof(ExtensionInToolbarPositions), GetValueFromProperty(prop.Value)); break; case "ContentControl": Manifest.ContentControl = GetValueFromProperty(prop.Value); break; case "AssemblyName": Manifest.AssemblyName = GetValueFromProperty(prop.Value); break; case "IsExtEnabled": Manifest.IsExtEnabled = bool.Parse(GetValueFromProperty(prop.Value)); AppSettings.AppExtensionEnabled = Manifest.IsExtEnabled; break; case "IsUWPExtension": Manifest.IsUWPExtension = bool.Parse(GetValueFromProperty(prop.Value)); break; case "Size": Manifest.Size = int.Parse(GetValueFromProperty(prop.Value)); break; } } }
public override void CopyFrom (OperationContext other) { base.CopyFrom (other); var o = other as ProjectOperationContext; if (o != null) GlobalProperties = new ProjectItemMetadata ((ProjectItemMetadata) o.GlobalProperties); }
public static void Unload() { roamingValues = null; localValues = null; roamingWebsites = null; localWebsites = null; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _mediaCapture = new MediaCapture(); _effectConfiguration = new PropertySet(); // This becomes relevant once MSFT:2300978 is fixed //effectProperties["Encoding"] = (VideoEncodingProperties)mediaCapture.VideoDeviceController.GetMediaStreamProperties(MediaStreamType.VideoPreview); _effectConfiguration["Saturation"] = 0.0f; }
public PropertySet( IPropertySet other, IListener listener, IPolicies policies, ICompilerMessageBuilder messageProvider, int interfaceIndex) { if(ReferenceEquals(other, null)) throw new ArgumentNullException(nameof(other)); if (ReferenceEquals(listener, null)) throw new ArgumentNullException(nameof(listener)); if (ReferenceEquals(policies, null)) throw new ArgumentNullException(nameof(policies)); if (ReferenceEquals(messageProvider, null)) throw new ArgumentNullException(nameof(messageProvider)); this.InterfaceName = other.InterfaceName ?? policies.GenerateSurrogateInterfaceName(interfaceIndex); if (ReferenceEquals(other.InterfaceName, null)) listener.Error(messageProvider.MissingInterfaceName(this.InterfaceName, interfaceIndex)); if (false == policies.IsValidInterfaceName(this.InterfaceName)) listener.Error(messageProvider.InvalidInterfaceName(this.InterfaceName, interfaceIndex)); if (ReferenceEquals(other.Properties, null)) { listener.Error(messageProvider.EmptyPropertiesList(this.InterfaceName, interfaceIndex)); return; } int propertyIndex = 0; foreach (var property in other.Properties.OfType<IBasicProperty>()) { this.Properties.Add( new BasicProperty(property, listener, policies, messageProvider, propertyIndex++)); } propertyIndex = 0; foreach (var property in other.Properties.OfType<IBlobProperty>()) { this.Properties.Add( new BlobProperty(property, listener, policies, messageProvider, propertyIndex++)); } propertyIndex = 0; foreach (var property in other.Properties.OfType<ITableValueProperty>()) { this.Properties.Add( new TableValueProperty(property, listener, policies, messageProvider, propertyIndex++)); } this.m_ixPropertyByName = this.Properties.ToDictionary( p => p.PropertyName, StringComparer.OrdinalIgnoreCase); }
/// <summary> /// Creates the property value map. /// </summary> /// <param name="props"> The props. </param> /// <returns> </returns> public Dictionary<MonthTypeContainer, string> CreatePropertyValueMap(IPropertySet props) { const string properties = "January.Duration=;February.Duration=;March.Duration=;April.Duration=;May.Duration=;June.Duration=;July.Duration=;August.Duration=;September.Duration=;October.Duration=;November.Duration=;December.Duration=;" + "January.Radiation=;February.Radiation=;March.Radiation=;April.Radiation=;May.Radiation=;June.Radiation=;July.Radiation=;August.Radiation=;September.Radiation=;October.Radiation=;November.Radiation=;December.Radiation=;" + "Annual.Duration="; return properties.Replace("=", "").Split(';') .ToDictionary(key => CommandExecutor.ExecuteCommand(new CreateEnumsFromPropertyStringsCommand(key)), value => props.GetValueAsString(value)); }
public void Construct(IPropertySet props) { configProps = props; strServer = props.GetProperty("Server").ToString(); strInstance = props.GetProperty("Instance").ToString(); strDatabase = props.GetProperty("Database").ToString(); strVersion = props.GetProperty("Version").ToString(); strUser = props.GetProperty("User").ToString(); strPasswd = props.GetProperty("Password").ToString(); }
public LocalStorageManager(string applicationUri, string tileId) { if (string.IsNullOrEmpty(tileId)) { tileId = PrimaryChannelId; } string name = string.Format("{0}-PushContainer-{1}-{2}", Package.Current.Id.Name, applicationUri, tileId); this.storageValues = ApplicationData.Current.LocalSettings.CreateContainer(name, ApplicationDataCreateDisposition.Always).Values; this.InitializeRegistrationInfoFromStorage(); }
public MrcVideoEffectDefinition() { Properties = new PropertySet { {"HologramCompositionEnabled", false}, //remove holograms {"RecordingIndicatorEnabled", false}, {"VideoStabilizationEnabled", false}, {"VideoStabilizationBufferLength", 0}, {"GlobalOpacityCoefficient", 0.9f}, {"StreamType", (int)MediaStreamType.Photo} }; }
public MapGraphicTrackExtension() { ILineElement traceElement = new LineElementClass(); SetDefaultSymbol(traceElement); //add a tag to the trace line IElementProperties elemProps = (IElementProperties)traceElement; elemProps.Name = "{E63706E1-B13C-4184-8AB8-97F67FA052D4}"; bool showTrace = true; propSet = new PropertySetClass(); propSet.SetProperty("Line Element", traceElement); propSet.SetProperty("Show Trace", showTrace); persist = (IPersistStream)propSet; }
public override void Construct(IPropertySet props) { base.Construct(props); m_layers = new Dictionary<int, QueryRasterLayer>(); JsonObject result = new JsonObject(); List<QueryRasterLayer> layerInfo = new List<QueryRasterLayer>(); foreach (IMapLayerInfo layer in GetMapLayerInfo()) { IRaster raster = GetDataSourceByID(layer.ID) as IRaster; if (raster != null) { m_layers.Add(layer.ID, new QueryRasterLayer(layer, raster)); } } }
public void Init() { PropertyInfo info = this.GetMemberOperationBase().GetMemberInfo() as PropertyInfo; if (info != null) { if ((this.IPropertyGet == null) && info.CanRead) { this.IPropertyGet = PropertyDelegateContainer.CreateIPropertyGet(info); } if ((this.IPropertySet == null) && info.CanWrite) { this.IPropertySet = PropertyDelegateContainer.CreateIPropertySet(info); } } }
public void Construct(IPropertySet props) { _configProps = props; imageServerInit = (IImageServerInit3)_serverObjectHelper.ServerObject; IName mosaicName = imageServerInit.ImageDataSourceName; if (mosaicName is IMosaicDatasetName) { IMosaicDataset md = (IMosaicDataset)mosaicName.Open(); _mosaicCatalog = md.Catalog; _supportRasterItemAccess = true; } else _supportRasterItemAccess = false; }
internal protected virtual void Initialize (Project project) { // There may be run configuration properties defined in the // main property group in the project. Those values have to // be initially loaded in new run configurations. using (var pi = project.MSBuildProject.CreateInstance ()) { pi.SetGlobalProperty ("BuildingInsideVisualStudio", "true"); pi.SetGlobalProperty ("RunConfiguration", ""); pi.OnlyEvaluateProperties = true; pi.Evaluate (); var lg = pi.GetPropertiesLinkedToGroup (MainPropertyGroup); Read (lg); properties = MainPropertyGroup; MainPropertyGroup.UnlinkFromProjectInstance (); } }
public void Construct(IPropertySet props) { configProps = props; // Read the properties. try { logger.LogMessage(ServerLogger.msgType.infoDetailed, "Construct", 8000, "Constructing IUCNRedListSOE"); // Get the feature layer to be queried. IMapServer3 mapServer = (IMapServer3)serverObjectHelper.ServerObject; string mapName = mapServer.DefaultMapName; IMapLayerInfo layerInfo; IMapLayerInfos layerInfos = mapServer.GetServerInfo(mapName).MapLayerInfos; // Find the index position of the map layer to query. int c = layerInfos.Count; int layerIndex = 0; for (int i = 0; i < c; i++) { layerInfo = layerInfos.get_Element(i); if (layerInfo.Name == "Species") { layerIndex = i; break; } } // Using IMapServerDataAccess to get the data, allows you to support MSD-based services. IMapServerDataAccess dataAccess = (IMapServerDataAccess)mapServer; // Get access to the source feature class. speciesFeatureClass = (IFeatureClass)dataAccess.GetDataSource(mapName, layerIndex); if (speciesFeatureClass == null) { logger.LogMessage(ServerLogger.msgType.error, "Construct", 8000, "SOE custom error: Layer name not found."); return; } else { logger.LogMessage(ServerLogger.msgType.infoDetailed, "Construct", 8000, "Succesfully found Species Layer."); } } catch { logger.LogMessage(ServerLogger.msgType.error, "Construct", 8000, "SOE custom error: Could not get the feature layer."); } }
public Extension(AppExtension ext, IPropertySet properties) { AppExtension = ext; _properties = properties as PropertySet; #region Properties if (_properties != null) { if (_properties.ContainsKey("Service")) { PropertySet serviceProperty = _properties["Service"] as PropertySet; _serviceName = serviceProperty["#text"].ToString(); } } #endregion //AUMID + Extension ID is the unique identifier for an extension UniqueId = ext.AppInfo.AppUserModelId + Consts.ArraySeparator + ext.Id; }
private void findButton_Click(object sender, EventArgs e) { String[] addressValues = addressTextBox.Text.Split(','); if (addressValues.Length == m_addressFields.Length) { IPropertySet addressProperties = createAddressProperties(m_addressFields, addressValues); GeocodeAddress(addressProperties); } else if (m_addressFields.Length == 1) { IPropertySet addressProperties = createAddressProperties(m_addressFields, addressValues); GeocodeAddress(addressProperties); } else { MessageBox.Show("Your address needs a comma between each expected address field or just commas to delimit those fields ", "Address Input Error"); } }
public void Connect() { try { IAGSServerConnectionFactory2 factory = new AGSServerConnectionFactoryClass(); if (this.ipropertySet_0 == null) { this.ipropertySet_0 = factory.ReadConnectionPropertiesFromFile(this.string_0); } this.iagsserverConnection2_0 = factory.Open(this.ipropertySet_0, 0) as IAGSServerConnection2; this.Init(null); this.method_1(); } catch (Exception exception) { MessageBox.Show(exception.Message); Logger.Current.Error("", exception, ""); } }
public object Create(object request, ISpecimenContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (request is Type type && type.IsAssignableTo <IPropertyContainer>()) { IPropertySet knownPropertySet = type.GetSchemaByKnownPropertySet(); if (knownPropertySet != null) { var propertyContainer = new MutablePropertyContainer(); foreach (IProperty property in knownPropertySet.GetProperties()) { object value = null; if (property.GetAllowedValuesUntyped() is { ValuesUntyped: { } allowedValues })
public void Apply() { if (this.bool_1) { this.bool_1 = false; int num = 36000; try { num = (int)(double.Parse(this.txtRecycleInterval.Text) * 3600.0); } catch { } IPropertySet recycleProperties = this.iserverObjectConfiguration_0.RecycleProperties; recycleProperties.SetProperty("Interval", num.ToString()); string str = this.timeEdit1.Time.Hour.ToString("00") + this.timeEdit1.Time.Minute.ToString(".00"); recycleProperties.SetProperty("Start", str); } }
private void UpdateOutputPropertySets(GPIOObject GPIOObj, IPropertySet Outputpropertys) { //OutPut.readImages(); // string keyPinValue = string.Format("GPIO.{0:00}", OutPut.PinNumber); string keyPinValue = GPIOObj.PinName; double dblValue = 0; Object Obj = null; if (Outputpropertys.TryGetValue(keyPinValue, out Obj)) { if (Obj != null) { dblValue = (double)Obj; // doInputPropertyUpdate = (dblValue != GPIOObj.PinValue); GPIOObj.PinValue = dblValue; } } }
public async Task GenerateChallengeAndProcessResponse() { PlayReadySoapMessage soapMessage = _serviceRequest.GenerateManualEnablingChallenge(); if (_uri == null) { _uri = soapMessage.Uri; } byte[] messageBytes = soapMessage.GetMessageBody(); HttpContent httpContent = new ByteArrayContent(messageBytes); IPropertySet propertySetHeaders = soapMessage.MessageHeaders; foreach (string strHeaderName in propertySetHeaders.Keys) { string strHeaderValue = propertySetHeaders[strHeaderName].ToString(); // The Add method throws an ArgumentException try to set protected headers like "Content-Type" // so set it via "ContentType" property if (strHeaderName.Equals("Content-Type", StringComparison.OrdinalIgnoreCase)) { httpContent.Headers.ContentType = MediaTypeHeaderValue.Parse(strHeaderValue); } else { httpContent.Headers.Add(strHeaderName.ToString(), strHeaderValue); } } HttpClient httpClient = new HttpClient(); HttpResponseMessage response = await httpClient.PostAsync(_uri, httpContent); string strResponse = await response.Content.ReadAsStringAsync(); Exception exResult = _serviceRequest.ProcessManualEnablingResponse(await response.Content.ReadAsByteArrayAsync()); if (exResult != null) { throw exResult; } }
public async void Run(IBackgroundTaskInstance taskInstance) { var deferral = taskInstance.GetDeferral(); // Credentials from settings to PasswordVault { IPropertySet LocalSettings = ApplicationData.Current.LocalSettings.Values; IPropertySet RoamingSettings = ApplicationData.Current.RoamingSettings.Values; if (LocalSettings.ContainsKey("username")) { var vault = new PasswordVault(); vault.Add(new PasswordCredential("Hermods Novo", (string)LocalSettings["username"], (string)LocalSettings["password"])); LocalSettings.Remove("username"); LocalSettings.Remove("password"); try { RoamingSettings.Remove("username"); RoamingSettings.Remove("password"); } catch { } } } // From 1.0.5.0 { const string FILE_NAME = "ebooksList.json"; StorageFolder StorageFolder = ApplicationData.Current.LocalFolder; var hermodsNovoEbooks = await StorageFolder.ContainsFileAsync(FILE_NAME) ? await StorageFolder.GetObjectAsync<HermodsNovoEbook[]>(FILE_NAME) : new HermodsNovoEbook[0]; if (hermodsNovoEbooks.Any(hne => hne.Url != null)) { var ebooks = hermodsNovoEbooks.Select(HermodsNovoEbookProvider.ConvertToEbook).ToArray(); await EbookStorage.SaveEbooksAsync(ebooks); } } deferral.Complete(); }
public static void TestDrawModel(IModelPoint mp, IModel model, List <string> filesPath) { if ((mp != null) && (model != null)) { string str = Application.StartupPath + @"\..\temp"; string str2 = Path.Combine(str, "osg"); string filePath = string.Format(@"{0}\{1}.osg", str2, mp.ModelName); if (!Directory.Exists(str)) { Directory.CreateDirectory(str); } if (!Directory.Exists(str2)) { Directory.CreateDirectory(str2); } IPropertySet images = null; IImage image = null; string key = string.Empty; images = new PropertySetClass(); if (filesPath != null) { foreach (string str5 in filesPath) { if (File.Exists(str5) || Directory.Exists(str5)) { key = Path.GetFileNameWithoutExtension(str5); image = resFactory.CreateImageFromFile(str5); images.SetProperty(key, image); } } } model.WriteFile(filePath, images); IModelPointSymbol symbol = (ModelPointSymbol)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("6BCF8C9B-E506-43AE-AD6E-44A41D748431"))); symbol.Color = 0xaaaaaaaa; mp.ModelName = filePath; mp.ModelEnvelope = model.Envelope; IRenderModelPoint item = Ocx.ObjectManager.CreateRenderModelPoint(mp, symbol, Ocx.ProjectTree.RootID); item.MaxVisibleDistance = 500000.0; tmpList.Add(item); Ocx.Camera.LookAtEnvelope(item.Envelope); } }
private async Task SetEffectWorker(string effect) { await ResetEffectsAsync(); blurAmountSlider.Visibility = Visibility.Collapsed; effectPropertySet = new PropertySet(); string typeName = null; switch (effect) { case displacementEffect: typeName = typeof(DisplacementEffect).FullName; break; case rotatingTilesEffect: typeName = typeof(RotatedTilesEffect).FullName; break; case gaussianBlurEffect: typeName = typeof(DynamicBlurVideoEffect).FullName; Debug.WriteLine("SliderValue: " + (float)blurAmountSlider.Value); effectPropertySet["ColorMatrix"] = new Matrix5x4() { M11 = (float)blurAmountSlider.Value, M12 = 0, M13 = 0, M14 = 0, M21 = 0, M22 = (float)blurAmountSlider.Value, M23 = 0, M24 = 0, M31 = 0, M32 = 0, M33 = (float)blurAmountSlider.Value, M34 = 0, M41 = 0, M42 = 0, M43 = 0, M44 = 1, M51 = 0, M52 = 0, M53 = 0, M54 = 0 } ; blurAmountSlider.Visibility = Visibility.Visible; break; } if (typeName == null) { return; } await mediaCapture.AddVideoEffectAsync(new VideoEffectDefinition(typeName, effectPropertySet), MediaStreamType.VideoPreview); }
/// <summary> /// Initializes a new instance of the <see cref="BiometryService" /> class. /// </summary> /// <param name="supported">A bool to know if the device is supported.</param> /// <param name="enrolled">A bool to know if the device is enrolled.</param> /// <param name="backgroundScheduler">The <see cref="IScheduler" /> to use.</param> public BiometryService(bool supported, bool enrolled, IScheduler backgroundScheduler) { backgroundScheduler.Validation().NotNull(nameof(backgroundScheduler)); _keys = ApplicationData.Current.LocalSettings.Values; _asyncLock = new AsyncLock(); _isSupported = Observable.Never <bool>() .StartWith(supported) .Replay(1, backgroundScheduler) .RefCount(); _isEnabled = _isSupported .Select(isSupported => isSupported && enrolled) .Replay(1, backgroundScheduler) .RefCount(); }
public static Dictionary<string, object> PropertySetToDictionary(IPropertySet propertySet) { if (propertySet == null) throw new ArgumentNullException("propertySet"); Int32 propertyCount = propertySet.Count; Dictionary<string, object> dictionary = new Dictionary<string, object>(); object[] nameArray = new object[1]; object[] valueArray = new object[1]; propertySet.GetAllProperties(out nameArray[0], out valueArray[0]); object[] names = (object[])nameArray[0]; object[] values = (object[])valueArray[0]; for (int i = 0; i < propertyCount; i++) { dictionary.Add(names[i].ToString(), values[i]); } return dictionary; }
public static MapTemplateElement CreateMapTemplateElement(IPropertySet pPropertySet, MapCartoTemplateLib.MapTemplate pMapTemplate) { string typeName = Convert.ToString(pPropertySet.GetProperty("ElementType")); MapCartoTemplateLib.MapTemplateGallery mapTemplateGallery = pMapTemplate.MapTemplateGallery; Type type = Type.GetType(typeName); try { MapTemplateElement element = Activator.CreateInstance(type, new object[] { -1, pMapTemplate }) as MapTemplateElement; element.Load(pPropertySet); return(element); } catch (Exception) { } return(null); }
public static string GetProperty(this IPropertySet prop, string propName) { if (prop.TryGetValue("@" + propName, out var attr) && attr is string s0) { return(s0); } if (!prop.TryGetValue(propName, out var ele)) { return(null); } if (ele is IPropertySet ps && ps.TryGetValue("#text", out var cont) && cont is string s1) { return(s1); } if (ele is object[]) { return(GetProperties(prop, propName).FirstOrDefault()); } return(null); }
protected override void Read(IPropertySet pset) { base.Read(pset); var prop = pset.GetProperty("GenerateDocumentation"); if (prop != null && documentationFile != null) { if (prop.GetValue <bool> ()) { documentationFile = ParentConfiguration.CompiledOutputName.ChangeExtension(".xml"); } else { documentationFile = null; } } optimize = pset.GetValue("Optimize", (bool?)null); }
private void method_0() { object obj2; object obj3; this.cboIsolationLevel.SelectedIndex = (int)this.iserverObjectConfiguration_0.IsolationLevel; IPropertySet recycleProperties = this.iserverObjectConfiguration_0.RecycleProperties; recycleProperties.GetAllProperties(out obj2, out obj3); try { int num = int.Parse(recycleProperties.GetProperty("Interval").ToString()); this.txtRecycleInterval.Text = ((double)(num / 3600)).ToString(); this.timeEdit1.Text = this.iserverObjectConfiguration_0.RecycleProperties.GetProperty("Start").ToString(); } catch { } }
private byte[] SrvcPropResHandler(NameValueCollection boundVariables, string outputFormat, string requestProperties, out string responseProperties) { responseProperties = "{\"Content-Type\" : \"application/json\"}"; IPropertySet pPorpSet = SOIBase.QueryConfigurationProperties(this.soHelper.ServerObject.ConfigurationName, this.soHelper.ServerObject.TypeName); JSONObject jo = new JSONObject(); jo.AddString("MaxRecordCount", pPorpSet.GetProperty("MaxRecordCount").ToString()); jo.AddString("MaxBufferCount", pPorpSet.GetProperty("MaxBufferCount").ToString()); jo.AddString("MaxImageHeight", pPorpSet.GetProperty("MaxImageHeight").ToString()); jo.AddString("MaxImageWidth", pPorpSet.GetProperty("MaxImageWidth").ToString()); jo.AddString("PhysicalOutputDirectory", pPorpSet.GetProperty("outputDir").ToString()); jo.AddString("PhysicalCacheDirectory", pPorpSet.GetProperty("cacheDir").ToString()); JSONObject result = new JSONObject(); result.AddJSONObject("serviceproperties", jo); return(Encoding.UTF8.GetBytes(result.ToJSONString(null))); }
/// <summary> /// Removes the umbriel property set (propertyset with a name/value of LayerExtension/umbriel /// </summary> /// <param name="layerExtensions">ILayerExtensions</param> internal static void RemovePropertySet(ILayerExtensions layerExtensions) { if (UmbrielPropertySetExists(layerExtensions)) { for (int i = 0; i < layerExtensions.ExtensionCount; i++) { object layerExtension = layerExtensions.get_Extension(i); if (layerExtension is IPropertySet) { IPropertySet propertySet = (IPropertySet)layerExtension; string val = propertySet.GetProperty("LayerExtension").ToString(); if (val.Equals("umbriel", StringComparison.CurrentCultureIgnoreCase)) { layerExtensions.RemoveExtension(i); } } } } }
/// <summary> /// Add a Ryken.Video.Effects.VideoEffect to the the MediaElement /// </summary> /// <param name="mediaElement">The MediaElement to add the effect to</param> /// <param name="id">The ID to use for this effect to frames can be processed by IVideoHandler</param> /// <param name="properties">Additional properties that will be passed to IVideoEffectHandler implementations registered with the provided ID. Can be null.</param> public static void AddVideoEffect(MediaElement mediaElement, string id, IPropertySet properties) { if (mediaElement == null) { throw new ArgumentNullException(nameof(mediaElement)); } if (string.IsNullOrWhiteSpace(id)) { throw new ArgumentException("Effect ID not set", nameof(id)); } if (properties == null) { properties = new PropertySet(); } if (!properties.ContainsKey(IDKey)) { properties.Add(IDKey, id); } mediaElement.AddVideoEffect(typeof(VideoEffect).FullName, false, properties); }
protected virtual void Initlize() { if (this.OID != -1) { IRow row = this.MapTemplateGallery.MapTemplateElementTable.GetRow(this.OID); this.Name = RowAssisant.GetFieldValue(row, "Name").ToString(); this.m_pElement = this.method_1(RowAssisant.GetFieldValue(row, "Element")); if (this.m_pElement is IMapSurroundFrame) { this.Style = (this.m_pElement as IMapSurroundFrame).MapSurround; } string str = RowAssisant.GetFieldValue(row, "Location").ToString(); this.ElementLocation = new MapCartoTemplateLib.ElementLocation(str); IPropertySet set = this.method_3(RowAssisant.GetFieldValue(row, "Attributes")); if (set != null) { this.PropertySet = set; } } }
/// <summary> /// Initializes the extension. /// </summary> /// <param name="classHelper">Provides a reference to the extension's class.</param> /// <param name="extensionProperties">A set of properties unique to the extension.</param> public void Init(IClassHelper classHelper, IPropertySet extensionProperties) { // Store the class helper as a member variable. this.classHelper = classHelper; IClass baseClass = classHelper.Class; // Get the names of the created and modified fields, if they exist. if (extensionProperties != null) { this.extensionProperties = extensionProperties; object createdObject = extensionProperties.GetProperty(Resources.CreatedFieldKey); object modifiedObject = extensionProperties.GetProperty(Resources.ModifiedFieldKey); object userObject = extensionProperties.GetProperty(Resources.UserFieldKey); // Make sure the properties exist and are strings. if (createdObject != null && createdObject is String) { createdFieldName = Convert.ToString(createdObject); } if (modifiedObject != null && modifiedObject is String) { modifiedFieldName = Convert.ToString(modifiedObject); } if (userObject != null && userObject is String) { userFieldName = Convert.ToString(userObject); } } else { // First time the extension has been run. Initialize with default values. InitNewExtension(); } // Set the positions of the fields. SetFieldIndexes(); // Set the current user name. userName = GetCurrentUser(); }
/// <summary> /// select a weather items given selected items from the listbox /// </summary> private void SelectWeatherItems() { //get the selected list from the listbox bool newSelection = this.chkNewSelection.Checked; //in case of a new selection, unselect all items first if (newSelection) { m_weatherLayer.UnselectAll(); } IPropertySet propSet = null; object o; long zipCode; //iterate through the selected items of the listbox foreach (int index in lstWeatherItemNames.SelectedIndices) { //get the weatheritem properties according to the zipCode of the item in the listbox propSet = m_weatherLayer.GetWeatherItem(Convert.ToString(lstWeatherItemNames.Items[index])); if (null == propSet) { continue; } o = propSet.GetProperty("ZIPCODE"); if (null == o) { continue; } zipCode = Convert.ToInt64(o); //select the item in the weather layer m_weatherLayer.Select(zipCode, false); } //refresh the display m_activeView.PartialRefresh(esriViewDrawPhase.esriViewGeography, m_weatherLayer, m_activeView.Extent); m_activeView.ScreenDisplay.UpdateWindow(); }
protected void GetProperties(IPropertySet propset) { object[] nameArray = new object[1]; object[] valueArray = new object[1]; propset.GetAllProperties(out nameArray[0], out valueArray[0]); object[] names = (object[])nameArray[0]; object[] values = (object[])valueArray[0]; System.Text.StringBuilder sb = new StringBuilder(); for (int i = 0; i < names.Length; i++) { sb.AppendLine(String.Format("{0}: {1}", names[i], values[i].ToString())); } System.Diagnostics.Debug.WriteLine(sb.ToString()); }
public static void Load() { if (roamingValues != null && localValues != null) { // Settings already loaded, there is nothing to load. return; } ApplicationDataContainer roamingSettings = ApplicationData.Current.RoamingSettings; ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; roamingValues = roamingSettings.Values; localValues = localSettings.Values; Debug.WriteLine("Application data version: {0}", ApplicationData.Current.Version); Debug.WriteLine("Roaming settings storage quota: {0} KB", ApplicationData.Current.RoamingStorageQuota); Debug.WriteLine("Roaming settings folder: {0}", ApplicationData.Current.RoamingFolder.Path); Debug.WriteLine("Local settings folder: {0}", ApplicationData.Current.LocalFolder.Path); InitializeOrValidateSettings(); }
internal protected override void Read(IPropertySet pset) { base.Read(pset); //we are assuming that if AppendTargetFrameworkToOutputPath has a value is .NET Core / .NET Standard proj. AppendTargetFrameworkToOutputPath = pset.GetValue <bool?> ("AppendTargetFrameworkToOutputPath", defaultValue: null); TargetFrameworkShortName = pset.GetValue("TargetFramework"); assembly = pset.GetValue("AssemblyName"); SignAssembly = pset.GetValue <bool> ("SignAssembly"); DelaySign = pset.GetValue <bool> ("DelaySign"); PublicSign = pset.GetValue <bool> (nameof(PublicSign)); AssemblyKeyFile = pset.GetPathValue("AssemblyOriginatorKeyFile", FilePath.Empty); if (string.IsNullOrEmpty(AssemblyKeyFile)) { AssemblyKeyFile = pset.GetPathValue("AssemblyKeyFile", FilePath.Empty); } if (compilationParameters != null) { compilationParameters.Read(pset); } }
public static IMutableObjectSchema ToSchema(this IPropertySet propertySet, string?schemaName = null) { if (propertySet is IMutableObjectSchema schema) { return(schema); } string?name = schemaName; if (name == null && propertySet is IKnownPropertySet knownPropertySet) { name = knownPropertySet.SchemaType.Name; } if (name == null) { name = propertySet.GetType().Name; } return(new MutableObjectSchema(name: name, properties: propertySet.GetProperties())); }
/// <summary> /// Creates a workspace to the SDE database from the command line args /// </summary> /// <param name="args">The command line args.</param> /// <returns>IWorkspace interface to the SDEWorkspace</returns> internal static IWorkspace Workspace(ref CommandLine.Utility.Arguments args) { // TODO: Maybe extend this to work with personal/file geodb in the future. Shouldn't be too difficult. IWorkspace workspace = null; string server = args["s"] ?? string.Empty; string instance = args["i"] ?? string.Empty; string user = args["u"] ?? string.Empty; string password = args["p"] ?? string.Empty; string database = args["D"] ?? string.Empty; string authmode = args["m"] ?? string.Empty; string version = args["V"] ?? string.Empty; IPropertySet propertyset = Utility.ArcSDEConnPropSet(server, instance, user, password, database, version, authmode); IWorkspaceFactory factory = new SdeWorkspaceFactoryClass(); workspace = factory.Open(propertyset, 0); return(workspace); }
public static async void Load() { IPropertySet localValues = ApplicationData.Current.LocalSettings.Values; string channelUriString = localValues[ChannelUriKey] as string; if (channelUriString == null) { PushNotificationChannel channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); channelUriString = channel.Uri; localValues[ChannelUriKey] = channelUriString; // TODO: Save expiration date (or decie if we want to renew the channel every time app is launched). } if (String.IsNullOrEmpty(channelUriString)) { throw new COMException("channelUriString", unchecked ((int)0x80070057)); } GetServerInfo(channelUriString); }
private static void CleanInvalidSettings(IPropertySet properties) { var toRemove = new List <string>(); foreach (var kvp in properties) { try { _ = JsonConvert.DeserializeObject <SettingBase>(kvp.Value as string, JsonOptions); } catch (Exception e) { System.Diagnostics.Debug.WriteLine($"Failed to deserialize setting: {kvp.Key}: {e.GetType()}: {e.Message}"); toRemove.Add(kvp.Key); } } foreach (var r in toRemove) { properties.Remove(r); } }
/// <summary> /// construct() is called only once, when the SOE is created, after IServerObjectExtension.init() is called. This /// method hands back the configuration properties for the SOE as a property set. You should include any expensive /// initialization logic for your SOE within your implementation of construct(). /// </summary> /// <param name="props">object propertySet</param> public void Construct(IPropertySet props) { AutoTimer timer = new AutoTimer(); this.LogInfoSimple(this.soeName + ": il costruttore è stato avviato.", MethodBase.GetCurrentMethod().Name); try { this.configProps = props; if (this.configProps.GetProperty("workspaceId") is string) { this.workspaceId = this.configProps.GetProperty("workspaceId") as string; } if (this.configProps.GetProperty("connectionString") is string) { this.workspace = Helper.OpenFileGdbWorkspace(this.configProps.GetProperty("connectionString") as string); } IMapServer3 mapServer = this.serverObjectHelper.ServerObject as IMapServer3; IMapServerInit mapServerInit = mapServer as IMapServerInit; string hostnameWebAdaptor = string.Empty; if (this.configProps.GetProperty("rootWebAdaptor") is string) { hostnameWebAdaptor = this.configProps.GetProperty("rootWebAdaptor") as string; } this.pathOutputVirtualAGS = Helper.CombineUri(hostnameWebAdaptor, mapServerInit.VirtualOutputDirectory); // c'è il replace perchè se il nome del servizio è in una cartella ags il percorso restituito ha '/' nel path tra folder ags e nome servizio this.pathOutputAGS = mapServerInit.PhysicalOutputDirectory.Replace('/', '\\'); } catch (Exception ex) { this.LogError(this.soeName + ": " + ex.Message, MethodBase.GetCurrentMethod().Name); } this.LogInfoSimple(this.soeName + ": il costruttore ha concluso", MethodBase.GetCurrentMethod().Name, timer.Elapsed); }
/// <summary> /// Searches ILayer's layerextensions for any PropertySets that contain name/value combo /// </summary> /// <param name="layer">The ILayer</param> /// <param name="propertysetname">The propertyset name.</param> /// <param name="propertysetvalue">The propertyset value.</param> /// <param name="comparison">The string comparison method</param> /// <returns>List of IPropertySet</returns> public static List <IPropertySet> FindExtensionPropertySet(this ILayer layer, string propertysetname, string propertysetvalue, StringComparison comparison) { List <IPropertySet> propertySets = new List <IPropertySet>(); ILayerExtensions layerExtensions = (ILayerExtensions)layer; try { if (layerExtensions.ExtensionCount > 0) { for (int i = 0; i < layerExtensions.ExtensionCount; i++) { object layerExtension = layerExtensions.get_Extension(i); if (layerExtension is IPropertySet) { IPropertySet propertySet = (IPropertySet)layerExtension; try { if (propertySet.GetProperty(propertysetname).ToString().Equals(propertysetvalue, comparison)) { propertySets.Add(propertySet); } } catch { } } } } return(propertySets); } catch (Exception ex) { Trace.WriteLine(ex.StackTrace); throw; } }
public static void AddRastersToImageService(IImageServer imageServer, List<string> fileNames, List<string> fileUrls, IPropertySet attributes) { //Construct an item description. IRasterItemDescription itemDescription = new RasterItemDescriptionClass(); //Define source raster names, locations, and type. IStringArray dataFileNames = new StrArrayClass(); //File names example: Image32.tif, Image32.tfw, Image32.aux. foreach (string fileName in fileNames) dataFileNames.Add(fileName); itemDescription.DataFileNames = dataFileNames; IStringArray dataFileURLs = new StrArrayClass(); //File URL examples: c:\temp\Image32.tif, c:\temp\Image32.tfw, http:\\host\Image32.aux. foreach (string fileurl in fileUrls) dataFileURLs.Add(fileurl); itemDescription.DataFileURLs = dataFileURLs; itemDescription.Type = "Raster Dataset"; //Raster pyramids,statistics,thumbnail. itemDescription.BuildPyramids = false; itemDescription.BuildThumbnail = false; itemDescription.ComputeStatistics = false; //If you need to overwrite default raster properties/metadata, provide here. itemDescription.Properties = attributes; //Construct item descriptions. IRasterItemDescriptions itemDescriptions = new RasterItemDescriptionsClass(); itemDescriptions.Add(itemDescription); //Add. IImageServerEditResults isEditResults = ((IImageServer4)imageServer).Add(itemDescriptions); }