Comienzos hacer ventana para cambiar Dataset y Nombre

Gerardo/Compilacion.net
Elena 2022-10-24 13:07:45 +02:00
parent 66c092ecf6
commit 23cd733c9b
9 changed files with 169 additions and 10 deletions

View File

@ -25,6 +25,7 @@ using OliviaAddInPro.Model.contract;
using ArcGIS.Core.Data.DDL; using ArcGIS.Core.Data.DDL;
using ArcGIS.Core.CIM; using ArcGIS.Core.CIM;
using System.Threading; using System.Threading;
using Microsoft.Win32;
namespace OliviaAddInPro.Helper namespace OliviaAddInPro.Helper
{ {
@ -2005,8 +2006,10 @@ namespace OliviaAddInPro.Helper
if (!string.IsNullOrEmpty(ext_)) if (!string.IsNullOrEmpty(ext_))
dlg.DefaultExt = ext_; dlg.DefaultExt = ext_;
if (brwsFilt != null) if (brwsFilt != null)
{
brwsFilt.BrowsingFilesMode = true;
dlg.BrowseFilter = brwsFilt; dlg.BrowseFilter = brwsFilt;
}
try try
{ {
bool? ok = dlg.ShowDialog(); bool? ok = dlg.ShowDialog();

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -148,6 +148,9 @@
<Compile Include="Model\TratamientoComun.cs" /> <Compile Include="Model\TratamientoComun.cs" />
<Compile Include="Model\Limpieza.cs" /> <Compile Include="Model\Limpieza.cs" />
<Compile Include="Model\LimpiezaDef.cs" /> <Compile Include="Model\LimpiezaDef.cs" />
<Compile Include="View\ProWindowSaveFileName.xaml.cs">
<DependentUpon>ProWindowSaveFileName.xaml</DependentUpon>
</Compile>
<Compile Include="Services\EjecServ.cs" /> <Compile Include="Services\EjecServ.cs" />
<Compile Include="Model\OliviaConf.cs" /> <Compile Include="Model\OliviaConf.cs" />
<Compile Include="Model\OliviaDef.cs" /> <Compile Include="Model\OliviaDef.cs" />
@ -159,6 +162,7 @@
<Compile Include="Services\LimpiezaServ.cs" /> <Compile Include="Services\LimpiezaServ.cs" />
<Compile Include="Services\ProcesoEjecServ.cs" /> <Compile Include="Services\ProcesoEjecServ.cs" />
<Compile Include="Services\RecogidaServ.cs" /> <Compile Include="Services\RecogidaServ.cs" />
<Compile Include="ViewModel\ShowProWindowSaveFileName.cs" />
<Compile Include="ViewModel\Comun\MarchandoUnaDeViewModel.cs" /> <Compile Include="ViewModel\Comun\MarchandoUnaDeViewModel.cs" />
<Compile Include="ViewModel\Configuracion\DockpaneConfigViewModel.cs" /> <Compile Include="ViewModel\Configuracion\DockpaneConfigViewModel.cs" />
<Compile Include="ViewModel\Configuracion\PaneConfigViewModel.cs" /> <Compile Include="ViewModel\Configuracion\PaneConfigViewModel.cs" />
@ -252,6 +256,10 @@
<Resource Include="OliviaIconPro.ico" /> <Resource Include="OliviaIconPro.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Page Include="View\ProWindowSaveFileName.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Comun\MarchandoUnaDe.xaml"> <Page Include="View\Comun\MarchandoUnaDe.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
@ -373,6 +381,12 @@
<ItemGroup> <ItemGroup>
<Resource Include="Images\help16Pro.png" /> <Resource Include="Images\help16Pro.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AddInContent Include="Images\GenericButtonPurple16.png" />
</ItemGroup>
<ItemGroup>
<AddInContent Include="Images\GenericButtonPurple32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- <!--
PackageAction can be: PackageAction can be:

View File

@ -748,6 +748,16 @@ namespace OliviaAddInPro.Services
msg_avisa = "No se encuentra el Dataset " + datname + ". "; msg_avisa = "No se encuentra el Dataset " + datname + ". ";
} }
} }
else
{
/////////////////////////////////////////
//no tiene un dataset configurado, saca ventana para elegir uno
//saca ventana para elegir Dataset, si se cancela, se guarda en el nombre por defecto en función del tratamiento y los ámbitos
//HelperGlobal.ponMsg("A continuación, seleccione nombre de Feature Class para importación. Si cancela el proceso, se establecerán el nombre y Dataset por defecto en función de los ámbitos y el tratamiento");
string path_aux = HelperGdb.SaveFileDlg("Seleccione Dataset donde importar", GdbFileName, null, ArcGIS.Desktop.Catalog.ItemFilters.featureDatasets_all);
if (!string.IsNullOrEmpty(path_aux))
tratamiento = System.IO.Path.GetDirectoryName(path_aux);
}
//crea el dataset o comprueba si existe //crea el dataset o comprueba si existe
string datasetNameOut = string.Empty; string datasetNameOut = string.Empty;
var resp = HelperGdb.CreateDataset(GdbFileName, tratamiento, spatRefData, out datasetNameOut); var resp = HelperGdb.CreateDataset(GdbFileName, tratamiento, spatRefData, out datasetNameOut);
@ -772,11 +782,15 @@ namespace OliviaAddInPro.Services
tratamiento = datasetNameOut; tratamiento = datasetNameOut;
} }
string dataset = tratamiento; string dataset = tratamiento;
/////////////////////////////////////////
//saca ventana para elegir nombre
ShowProWindowSaveFileName wndFileName = new ShowProWindowSaveFileName(ambitos);
string amb_aux = wndFileName.GetName();
if (!string.IsNullOrEmpty(amb_aux))
ambitos = amb_aux;
///////////////////////////////////////// /////////////////////////////////////////
//todo ok, se pone a importar //todo ok, se pone a importar
string err_st =string.Empty; string err_st =string.Empty;
string name = ambitos;
string path_import = GdbFileName + "\\" + dataset + "\\" + ambitos; string path_import = GdbFileName + "\\" + dataset + "\\" + ambitos;
int NIMPORT; int NIMPORT;
string[] noms_shp = null; string[] noms_shp = null;

View File

@ -0,0 +1,24 @@
<controls:ProWindow x:Class="OliviaAddInPro.ProWindowSaveFileName"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"
mc:Ignorable="d"
Title="Guardar elemento como..." Height="145.946" Width="544.144"
WindowStartupLocation="CenterOwner" Closed="ProWindow_Closed" Closing="ProWindow_Closing"
>
<controls:ProWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</controls:ProWindow.Resources>
<StackPanel Height="108" VerticalAlignment="Top" Margin="0,0,2,0">
<TextBox HorizontalAlignment="Left" Height="35" Margin="20,8,0,0" TextWrapping="Wrap" Text="{Binding Path=Texto, Mode = TwoWay}" VerticalAlignment="Top" Width="491" KeyUp="TextBox_KeyUp"/>
<Button Content="Guardar" HorizontalAlignment="Left" Height="35" Margin="387,20,0,0" Width="124" Click="Button_Click"/>
</StackPanel>
</controls:ProWindow>

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace OliviaAddInPro
{
/// <summary>
/// Interaction logic for ProWindowSaveFileName.xaml
/// </summary>
public partial class ProWindowSaveFileName : ArcGIS.Desktop.Framework.Controls.ProWindow
{
private bool ok = false;
public ProWindowSaveFileName()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
ok = true;
Close();
}
private void ProWindow_Closed(object sender, EventArgs e)
{
}
private void ProWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (ok)
DialogResult = true;
else
DialogResult = false;
}
private void TextBox_KeyUp(object sender, KeyEventArgs e)
{
if(e.Key==Key.Enter)
{
ok = true;
Close();
}
}
}
}

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
namespace OliviaAddInPro
{
internal class ShowProWindowSaveFileName : Button
{
private ProWindowSaveFileName _prowindowsavefilename = null;
private string texto;
public string Texto
{
get { return texto; }
set { base.SetProperty(ref texto, value, () => Texto); }
}
public ShowProWindowSaveFileName(string text_in)
{
Texto = text_in;
crea();
}
public string GetName()
{
bool? res = _prowindowsavefilename.ShowDialog();
if (res ?? true)
{
return Texto;
}
return string.Empty;
}
private void crea()
{
//already open?
if (_prowindowsavefilename != null)
return;
_prowindowsavefilename = new ProWindowSaveFileName();
_prowindowsavefilename.Owner = FrameworkApplication.Current.MainWindow;
}
}
}