Esempio n. 1
0
 public WmsRasterLayerConfigViewModel(bool getWmsSourceFromDataRepsitory = false)
 {
     wmsDataRepository             = new ObservableCollection <WmsRasterLayerConfigViewModel>();
     selectedWms                   = this;
     formats                       = new ObservableCollection <string>();
     styles                        = new ObservableCollection <string>();
     wmsServerUrl                  = string.Empty;
     addToDataRepositoryVisibility = Visibility.Collapsed;
     availableLayers               = new ObservableCollection <WmsLayerViewModel>();
     previewSource                 = GetDefaultPreview();
 }
        public WmsRasterLayerConfigWindow(bool getWmsSourceFromDataRepsitory = false)
        {
            InitializeComponent();
            viewModel   = new WmsRasterLayerConfigViewModel(getWmsSourceFromDataRepsitory);
            DataContext = viewModel;

            Messenger.Default.Register <DialogMessage>(this, viewModel, (message) =>
            {
                System.Windows.Forms.MessageBox.Show(message.Content, message.Caption, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
            });

            Messenger.Default.Register <bool>(this, viewModel, (message) =>
            {
                DialogResult = message;
            });

            Closing += (s, e) =>
            {
                Messenger.Default.Unregister(this);
            };
        }