0

I have a custom tab with an inline gallery of web maps. The items displayed in the gallery are dependent on a userid that is entered in a window on the same tab. The userid is stored as a Project setting.

The gallery loads fine the first time the tab open using the last entered userid. However when a new userid is entered I don't know how to force the gallery to reload items with the new userid. Forcing the gallery to reload would be enough as the initialize event does what I need. Alternatively I could add my code to populate the gallery using an event but I don't know how to trigger an event on the gallery.

Here is the gallery Initialize code

public GalleryInline()
{

    Initialize();
}


private async void Initialize()
{
    if (_isInitialized)
        return;


    if (Module1.Current.API_KEY.API_KEY_Value == null || Module1.Current.API_KEY.API_KEY_Value == "" )
    {
        FrameworkApplication.State.Deactivate("tate_connection");
        return;
    }
    else
    {
        var lstWebmapItems = await GetMosicsAsync();
        if (lstWebmapItems.Count>0)
        {
            foreach (var dataItem in lstWebmapItems)
                Add(dataItem);
            _isInitialized = true;
        }

    }
}

I would like to be able to call similar code in response to a button click on a different control on the same tab.

Here is the code for the ICommand item on that other control. This is where I would like to force the gallery above to reload it's contents.

private ICommand _clickCommand;
public ICommand ClickCommand
{
    get
    {
        return _clickCommand ?? (_clickCommand = new CommandHandler(() => getkey(), CanExecute));
    }
}

public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}

private void getkey()
{

    IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("MyAddin_GalleryInline");
    var command = wrapper as ICommand;
    FrameworkApplication.ActivateTab("MyAddin_Tab1");
    //command.Execute("redd");
    FrameworkApplication.State.Activate("state_connection");

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.