// This is an event handler that generates and returns QueryStore refresh parameters as necessary
        private void QueryImageStoreControl_LoadQueryListClick(object sender, Utils.GenericEventArgs <object, Dictionary <string, object> > e)
        {
            var isvm = e.Data as QueryImageStoreViewModel;

            if (isvm == null)
            {
                return;
            }

            Dictionary <string, object> storeRefreshPropertyBag = null;

            if (isvm.Name == "Local") // Right now, only the local QueryStore needs a file popup, this can be expanded later
            {
                using (var ofd = new Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog())
                {
                    ofd.IsFolderPicker = true;
                    ofd.Title          = "Choose folder containing query images";

                    Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult result = ofd.ShowDialog();

                    if (result == Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
                    {
                        storeRefreshPropertyBag = new Dictionary <string, object>();
                        storeRefreshPropertyBag.Add("filePath", ofd.FileName);
                    }
                }
            }
            else if (isvm.Name == "Azure")
            {
                storeRefreshPropertyBag = new Dictionary <string, object>(); //no parameters for Azure store
            }
            e.ReturnValue = storeRefreshPropertyBag;
        }
示例#2
0
        private bool SetGamePath()
        {
            //require [Windows API Code Pack]
            //in Visual Studio, open [Tool->Package Manager Consol]
            //input the command [Install-Package WindowsAPICodePack-Shell]
            var dialog = new Microsoft.WindowsAPICodePack.Dialogs.CommonOpenFileDialog();

            dialog.IsFolderPicker = true;
            Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult result = dialog.ShowDialog();
            if (result != Microsoft.WindowsAPICodePack.Dialogs.CommonFileDialogResult.Ok)
            {
                return(false);
            }
            Configure.InstallPath = dialog.FileName;
            WindowCallbacks.Print(StringAdapter.GetResource("Menu_SetPath") + " : " + dialog.FileName);
            return(true);
        }