public SaveSearchViewModel(MessageBus messageBus, SearchResults results, bool enableAddNew) { MessageBus = messageBus ?? throw new ArgumentNullException("messageBus"); var msg = new GetServerSettingsMessage(); MessageBus.Publish(msg).Wait(); ConnectionProfile = msg.Profile; ServiceModel = msg.ServiceModel; // available layers EnableAddNew = enableAddNew; if (EnableAddNew) { AvailableLayers.Add(new Layer() { Id = SaveSearchConstraintViewModel.AddNewLayerId, Name = "(new layer)" }); } ServiceModel.Layers.ToList().ForEach(l => AvailableLayers.Add(new Layer() { Id = l.Id, Name = l.Name, Description = l.Description })); FeatureService = ServiceModel.FeatureService.AbsoluteUri; results.ValueNames.ToList().ForEach(name => ConstraintsToSave.Add( new SaveSearchConstraintViewModel(name, AvailableLayers) { IncludeInSave = true, TargetLayerId = SaveSearchConstraintViewModel.AddNewLayerId })); }
public RocketLeagueProfileManager() : base("Rocket League", "rocketleague", "rocketleague.exe", typeof(RocketLeagueSettings), typeof(Control_RocketLeague), new GameEvent_RocketLeague()) { AvailableLayers.Add(LayerType.RocketLeagueBackground); IconURI = "Resources/rocketleague_256x256.png"; }
public GTA5ProfileManager() : base("GTA 5", "gta5", "gta5.exe", typeof(GTA5Settings), typeof(Control_GTA5), new GameEvent_GTA5()) { AvailableLayers.Add(LayerType.GTA5Background); AvailableLayers.Add(LayerType.GTA5PoliceSiren); IconURI = "Resources/gta5_64x64.png"; }
public Dota2ProfileManager() : base("Dota 2", "dota2", "dota2.exe", typeof(Dota2Settings), typeof(Control_Dota2), new GameEvent_Dota2()) { AvailableLayers.Add(LayerType.Dota2Background); AvailableLayers.Add(LayerType.Dota2Respawn); AvailableLayers.Add(LayerType.Dota2Abilities); AvailableLayers.Add(LayerType.Dota2Items); AvailableLayers.Add(LayerType.Dota2HeroAbiltiyEffects); AvailableLayers.Add(LayerType.Dota2Killstreak); IconURI = "Resources/dota2_64x64.png"; }
public CSGOProfileManager() : base("CS:GO", "csgo", "csgo.exe", typeof(CSGOSettings), typeof(Control_CSGO), new GameEvent_CSGO()) { AvailableLayers.Add(LayerType.CSGOBackground); AvailableLayers.Add(LayerType.CSGOBomb); AvailableLayers.Add(LayerType.CSGOKillsIndicator); AvailableLayers.Add(LayerType.CSGOBurning); AvailableLayers.Add(LayerType.CSGOFlashbang); AvailableLayers.Add(LayerType.CSGOTyping); IconURI = "Resources/csgo_64x64.png"; }
private void ExportConfigOnPropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(ExportConfigModel.UseCropping): OnPropertyChanged(nameof(UseCropping)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportConfigModel.CropStart): case nameof(ExportConfigModel.CropEnd): OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportConfigModel.Layer): if (models.ExportConfig.Layer < 0) { selectedLayer = AvailableLayers.Last(); } else { selectedLayer = AvailableLayers[models.ExportConfig.Layer]; } OnPropertyChanged(nameof(SelectedLayer)); // preview layer if (models.ExportConfig.Layer >= 0) { models.Display.ActiveLayer = models.ExportConfig.Layer; } break; case nameof(ExportConfigModel.Mipmap): if (models.ExportConfig.Mipmap < 0) { selectedMipmap = AvailableMipmaps.Last(); } else { selectedMipmap = AvailableMipmaps[models.ExportConfig.Mipmap]; } OnPropertyChanged(nameof(SelectedMipmap)); Crop.Mipmap = selectedMipmap.Cargo; // preview mipmap models.Display.ActiveMipmap = Math.Max(models.ExportConfig.Mipmap, 0); break; } }
public RecrusiveTexture GetLayer(AvailableLayers layer) { switch (layer) { case AvailableLayers.back: return(layers[0]); case AvailableLayers.middle: return(layers[1]); case AvailableLayers.frontBottom: return(layers[2]); case AvailableLayers.frontTop: return(layers[3]); default: return(null); } }
public ExportViewModel(Models.Models models) { this.models = models; // init layers for (var i = 0; i < models.Images.NumLayers; ++i) { AvailableLayers.Add(new ComboBoxItem <int>("Layer " + i, i)); } selectedLayer = AvailableLayers[models.Export.Layer]; Debug.Assert(selectedLayer.Cargo == models.Export.Layer); // init mipmaps for (var i = 0; i < models.Images.NumMipmaps; ++i) { AvailableMipmaps.Add(new ComboBoxItem <int>("Mipmap " + i, i)); } selectedMipmap = AvailableMipmaps[models.Export.Mipmap]; Debug.Assert(selectedMipmap.Cargo == models.Export.Mipmap); // all layer option for ktx and dds if (models.Images.NumLayers > 1 && (models.Export.FileType == FileFormat.Ktx || models.Export.FileType == FileFormat.Ktx2 || models.Export.FileType == FileFormat.Dds)) { AvailableLayers.Add(new ComboBoxItem <int>("All Layer", -1)); selectedLayer = AvailableLayers.Last(); models.Export.Layer = selectedLayer.Cargo; } // all mipmaps option for ktx and dds if (models.Images.NumMipmaps > 1 && (models.Export.FileType == FileFormat.Ktx || models.Export.FileType == FileFormat.Ktx2 || models.Export.FileType == FileFormat.Dds)) { AvailableMipmaps.Add(new ComboBoxItem <int>("All Mipmaps", -1)); selectedMipmap = AvailableMipmaps.Last(); models.Export.Mipmap = selectedMipmap.Cargo; } // init formats foreach (var format in models.Export.SupportedFormats) { AvailableFormat.Add(new ComboBoxItem <DisplayedFormat>(format.DisplayedName, format)); if (format == models.Export.TexFormat) { SelectedFormat = AvailableFormat.Last(); } } models.Export.PropertyChanged += ExportOnPropertyChanged; }
public ProfileManager(string name, string internal_name, string[] process_names, Type settings, Type control, LightEvent game_event) { Name = name; InternalName = internal_name; ProcessNames = process_names; Icon = null; Control = null; ControlType = control; SettingsType = settings; Settings = (ProfileSettings)Activator.CreateInstance(settings); game_event.Profile = this; Event = game_event; Profiles = new Dictionary <string, ProfileSettings>(); EffectScripts = new Dictionary <string, dynamic>(); if (game_event._game_state != null) { ParameterLookup = Utils.GameStateUtils.ReflectGameStateParameters(game_event._game_state.GetType()); } else { ParameterLookup = new Dictionary <string, Tuple <Type, Type> >(); } if (AvailableLayers == null) { AvailableLayers = new HashSet <LayerType>(); } AvailableLayers.Add(LayerType.Default); AvailableLayers.Add(LayerType.Solid); AvailableLayers.Add(LayerType.SolidFilled); AvailableLayers.Add(LayerType.Gradient); AvailableLayers.Add(LayerType.GradientFill); AvailableLayers.Add(LayerType.Breathing); AvailableLayers.Add(LayerType.Blinking); AvailableLayers.Add(LayerType.Image); AvailableLayers.Add(LayerType.Percent); AvailableLayers.Add(LayerType.PercentGradient); AvailableLayers.Add(LayerType.Interactive); AvailableLayers.Add(LayerType.ShortcutAssistant); AvailableLayers.Add(LayerType.Equalizer); AvailableLayers.Add(LayerType.Ambilight); AvailableLayers.Add(LayerType.LockColor); LoadProfiles(); }
// Initializes the available layers based on the parent service and clears the selected layers private void initializeLayers() { AvailableLayers.Clear(); SelectedLayers.Clear(); // Make sure the service is a type that contains sublayers if (!(Service is FeatureService) && !(Service is MapService)) { return; // Other service types don't have sublayers } // Loop through each sublayer in the service dynamic serviceAsDynamic = Service; foreach (FeatureLayerDescription layer in serviceAsDynamic.Layers) { // Create a feature layer for the sublayer string id = Guid.NewGuid().ToString("N"); FeatureLayer fLayer = new FeatureLayer() { Url = string.Format("{0}/{1}", Service.Url, layer.Id), OutFields = new OutFields() { "*" }, ProxyUrl = ProxyUrl, ID = id }; // Initialize the layer's name string name = !string.IsNullOrEmpty(layer.Name) ? layer.Name : id; MapApplication.SetLayerName(fLayer, name); // Add the layer to the set of available layers AvailableLayers.Add(fLayer); } }
public void Draw(AvailableLayers layer, SpriteBatch spriteBatch, Camera camera) { GetLayer(layer).Draw(spriteBatch, camera, -2, 0); }
public ExportViewModel(ModelsEx models, string extension, GliFormat preferredFormat, string filename, bool is3D, DefaultStatistics stats) { this.models = models; this.extension = extension; this.filename = filename; this.is3D = is3D; this.usedFormat = models.Export.Formats.First(fmt => fmt.Extension == extension); models.Display.IsExporting = true; Quality = models.Settings.LastQuality; // init layers for (var i = 0; i < models.Images.NumLayers; ++i) { AvailableLayers.Add(new ListItemViewModel <int> { Cargo = i, Name = "Layer " + i }); } selectedLayer = AvailableLayers[models.Export.Layer]; Debug.Assert(selectedLayer.Cargo == models.Export.Layer); // init mipmaps for (var i = 0; i < models.Images.NumMipmaps; ++i) { AvailableMipmaps.Add(new ListItemViewModel <int> { Cargo = i, Name = "Mipmap " + i }); } selectedMipmap = AvailableMipmaps[models.Export.Mipmap]; Debug.Assert(selectedMipmap.Cargo == models.Export.Mipmap); // all layer option for ktx and dds if (models.Images.NumLayers > 1 && (extension == "ktx" || extension == "dds")) { AvailableLayers.Add(new ListItemViewModel <int> { Cargo = -1, Name = "All Layer" }); selectedLayer = AvailableLayers.Last(); models.Export.Layer = selectedLayer.Cargo; } // all mipmaps option for ktx and dds if (models.Images.NumMipmaps > 1 && (extension == "ktx" || extension == "dds")) { AvailableMipmaps.Add(new ListItemViewModel <int> { Cargo = -1, Name = "All Mipmaps" }); selectedMipmap = AvailableMipmaps.Last(); models.Export.Mipmap = selectedMipmap.Cargo; } // init available pixel data types var usedPixelTypes = new SortedSet <PixelDataType>(); foreach (var format in usedFormat.Formats) { // exclude some formats for 3d export if (is3D && format.IsExcludedFrom3DExport()) { continue; } allFormats.Add(new ListItemViewModel <GliFormat> { Cargo = format, Name = format.ToString(), ToolTip = format.GetDescription() }); formatRatings.Add(stats.GetFormatRating(format, preferredFormat)); usedPixelTypes.Add(format.GetDataType()); } if (usedPixelTypes.Count > 1) { AvailableDataTypes.Add(new ListItemViewModel <PixelDataType> { Cargo = PixelDataType.Undefined, Name = "All" }); } var preferredPixelType = preferredFormat.GetDataType(); foreach (var usedPixelType in usedPixelTypes) { AvailableDataTypes.Add(new ListItemViewModel <PixelDataType> { Cargo = usedPixelType, Name = usedPixelType.ToString(), ToolTip = usedPixelType.GetDescription() }); if (usedPixelType == preferredPixelType) { SelectedDataType = AvailableDataTypes.Last(); } } if (SelectedDataType == null) { SelectedDataType = AvailableDataTypes[0]; } // assert that those were were set by SelectedDataType Debug.Assert(AvailableFormats != null); Debug.Assert(SelectedFormat != null); // enable quality if (extension == "jpg") { hasQualityValue = true; nonSrgbExportWarnings = true; } else if (extension == "bmp") { nonSrgbExportWarnings = true; } else { SetKtxDdsQuality(); } models.Export.PropertyChanged += ExportOnPropertyChanged; if (models.Export.CropEndX == 0 && models.Export.CropEndY == 0 && models.Export.CropEndZ == 0) { // assume cropping was not set SetMaxCropping(); } }
private void ExportOnPropertyChanged(object sender, PropertyChangedEventArgs args) { switch (args.PropertyName) { case nameof(ExportModel.UseCropping): OnPropertyChanged(nameof(UseCropping)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropStartX): OnPropertyChanged(nameof(CropStartX)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropStartY): OnPropertyChanged(nameof(CropStartY)); OnPropertyChanged(nameof(CropEndY)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropStartZ): OnPropertyChanged(nameof(CropStartZ)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropEndX): OnPropertyChanged(nameof(CropEndX)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropEndY): OnPropertyChanged(nameof(CropEndY)); OnPropertyChanged(nameof(CropStartY)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropEndZ): OnPropertyChanged(nameof(CropEndZ)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.Mipmap): if (models.Export.Mipmap < 0) { selectedMipmap = AvailableMipmaps.Last(); } else { selectedMipmap = AvailableMipmaps[models.Export.Mipmap]; } OnPropertyChanged(nameof(SelectedMipmap)); OnPropertyChanged(nameof(UseCropping)); OnPropertyChanged(nameof(CropMaxX)); OnPropertyChanged(nameof(CropMaxY)); OnPropertyChanged(nameof(CropMaxZ)); // refit start and end since dimensions changed CropStartX = CropStartX; CropStartY = CropStartY; CropStartZ = CropStartZ; CropEndX = CropEndX; CropEndY = CropEndY; CropEndZ = CropEndZ; // force change on y components because coordinate flipping OnPropertyChanged(nameof(CropStartY)); OnPropertyChanged(nameof(CropEndY)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.Layer): if (models.Export.Layer < 0) { selectedLayer = AvailableLayers.Last(); } else { selectedLayer = AvailableLayers[models.Export.Layer]; } OnPropertyChanged(nameof(SelectedLayer)); break; case nameof(ExportModel.Quality): OnPropertyChanged(nameof(Quality)); break; } }
private void Connect() { if (Uri.IsWellFormedUriString(WmsServerUrl, UriKind.Absolute)) { if (WmsRasterLayer == null) { InitializeWmsRasterLayer(); } IsBusy = true; Task.Factory.StartNew(new Action(() => { Collection <string> styleNames = new Collection <string>(); Collection <string> outputFormats = new Collection <string>(); Collection <string> serverLayerNames = new Collection <string>(); try { if (!string.IsNullOrEmpty(UserName) && !string.IsNullOrEmpty(Password)) { WmsRasterLayer.Credentials = new NetworkCredential(UserName, Password); } if (!WmsRasterLayer.IsOpen) { WmsRasterLayer.Open(); } styleNames = WmsRasterLayer.GetServerStyleNames(); outputFormats = WmsRasterLayer.GetServerOutputFormats(); serverLayerNames = WmsRasterLayer.GetServerLayerNames(); } catch (Exception ex) { GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex)); Application.Current.Dispatcher.BeginInvoke(new Action(() => { SendMessageBox(ex.Message, "Warning"); })); } finally { var action = new Action(() => { foreach (var item in styleNames) { styles.Add(item); } foreach (var item in outputFormats) { formats.Add(item); } if (serverLayerNames.Count() > 0) { AvailableLayers.Clear(); foreach (var serverLayer in serverLayerNames) { if (!string.IsNullOrEmpty(serverLayer)) { AvailableLayers.Add(new WmsLayerViewModel(serverLayer)); } } } IsBusy = false; }); if (Application.Current != null) { Application.Current.Dispatcher.BeginInvoke(action); } else { action(); } } })); } else { SendMessageBox("The server address is not valid.", "Info"); } }
private void ExportOnPropertyChanged(object sender, PropertyChangedEventArgs args) { switch (args.PropertyName) { case nameof(ExportModel.UseCropping): OnPropertyChanged(nameof(UseCropping)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropMinX): OnPropertyChanged(nameof(CropMinX)); break; case nameof(ExportModel.CropMinY): OnPropertyChanged(nameof(CropMinY)); break; case nameof(ExportModel.CropMaxX): OnPropertyChanged(nameof(CropMaxX)); break; case nameof(ExportModel.CropMaxY): OnPropertyChanged(nameof(CropMaxY)); break; case nameof(ExportModel.CropStartX): OnPropertyChanged(nameof(CropStartX)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropStartY): OnPropertyChanged(nameof(CropStartY)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropEndX): OnPropertyChanged(nameof(CropEndX)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.CropEndY): OnPropertyChanged(nameof(CropEndY)); OnPropertyChanged(nameof(IsValid)); break; case nameof(ExportModel.Mipmap): if (models.Export.Mipmap < 0) { selectedMipmap = AvailableMipmaps.Last(); } else { selectedMipmap = AvailableMipmaps[models.Export.Mipmap]; } OnPropertyChanged(nameof(SelectedMipmap)); break; case nameof(ExportModel.Layer): if (models.Export.Layer < 0) { selectedLayer = AvailableLayers.Last(); } else { selectedLayer = AvailableLayers[models.Export.Layer]; } OnPropertyChanged(nameof(SelectedLayer)); break; case nameof(ExportModel.Quality): OnPropertyChanged(nameof(Quality)); break; case nameof(ExportModel.AllowCropping): OnPropertyChanged(nameof(AllowCropping)); break; } }