Ejemplo n.º 1
0
        protected async override void OnClick()
        {
            try
            {
                OpenItemDialog selectAoiDialog = new OpenItemDialog()
                {
                    Title       = "Select AOI Folder",
                    MultiSelect = false,
                    Filter      = ItemFilters.folders
                };
                if (selectAoiDialog.ShowDialog() == true)
                {
                    Module1.DeactivateState("Aoi_Selected_State");
                    IEnumerable <Item> selectedItems = selectAoiDialog.Items;
                    var            e    = selectedItems.FirstOrDefault();
                    BA_Objects.Aoi oAoi = await GeneralTools.SetAoiAsync(e.Path);

                    if (oAoi != null)
                    {
                        Module1.Current.CboCurrentAoi.SetAoiName(oAoi.Name);
                        MessageBox.Show("AOI is set to " + oAoi.Name + "!", "BAGIS PRO");
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("An error occurred while trying to set the AOI!! " + e.Message, "BAGIS PRO");
            }
        }