Exemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     openFileDlg                  = new Microsoft.Win32.OpenFileDialog();
     listPlainOptionWindow        = null;
     listMapLayerOptionWindow     = null;
     listOptionsWithExampleWindow = null;
     statResultsWindow            = null;
     sumResultsWindow             = null;
 }
Exemplo n.º 2
0
        void Process_Response(ArrayList respList)
        {
            //Options: Mapping Inside, Nearby and Density
            if (this.listPlainOptionWindow != null)
            {
                this.listPlainOptionWindow.Close();
            }
            if (this.listMapLayerOptionWindow != null)
            {
                this.listMapLayerOptionWindow.Close();
            }
            if (this.listOptionsWithExampleWindow != null)
            {
                this.listOptionsWithExampleWindow.Close();
            }
            if (this.statResultsWindow != null)
            {
                this.statResultsWindow.Close();
            }
            if (this.sumResultsWindow != null)
            {
                this.sumResultsWindow.Close();
            }

            foreach (DialogueResponse resp in respList)
            {
                switch (resp.DlgRespType)
                {
                case DialogueResponseType.speechError:
                    speechSyn.SpeakAsync(resp.RespContent.ToString());
                    Log(resp.RespContent.ToString(), "error");
                    break;

                case DialogueResponseType.speechInfo:
                    speechSyn.SpeakAsync(resp.RespContent.ToString());
                    Log(resp.RespContent.ToString(), "info");
                    break;

                case DialogueResponseType.speechQuestion:
                    speechSyn.SpeakAsync(resp.RespContent.ToString());
                    Log("Question: " + resp.RespContent.ToString(), "info");
                    break;

                case DialogueResponseType.mapLayerAdded:
                    mapMgr.AddLayer(resp.RespContent.ToString(), 4);
                    Log("A new map layer is added: " + resp.RespContent.ToString(), "info");
                    break;

                case DialogueResponseType.bufferZoneAdded:


                    string layername = mapMgr.GetLayeNameFromPath(resp.RespContent.ToString());
                    speechSyn.SpeakAsync("A buffer zone is added");
                    Log("A buffer zone is added: " + resp.RespContent.ToString(), "info");
                    break;

                case DialogueResponseType.mapLayerRemoved:
                    mapMgr.HideLayer(resp.RespContent.ToString());
                    Log("A new map layer is hidden: " + resp.RespContent.ToString(), "info");
                    break;

                case DialogueResponseType.mapDocumentOpened:
                    mapMgr.LoadMap(resp.RespContent.ToString());
                    Log("A new map document is opened: " + resp.RespContent.ToString(), "info");
                    break;

                case DialogueResponseType.featureLayerInfo:
                    Console.WriteLine("****************************");
                    string feature_class = resp.RespContent.ToString();
                    Console.WriteLine("_mapMgr.GetTotalSelectedFeaturesInLayer=" + MapManager.GetTotalSelectedFeaturesInLayer(feature_class));
                    MapManager.SelectFeaturesByAttributes(feature_class, "");
                    int count = this.MapManager.GetTotalSelectedFeaturesInLayer(feature_class);
                    MapManager.ClearMapSelection();
                    feature_class = String.Join(" ", feature_class.Split('_'));
                    Log("There are total of " + count + " " + feature_class + ".", "info");
                    speechSyn.SpeakAsync("There are total of " + count + " " + feature_class + ".");
                    break;

                case DialogueResponseType.listPlainOptions:
                    PlainOptionListData optionListData = resp.RespContent as PlainOptionListData;
                    if (optionListData != null)
                    {
                        this.listPlainOptionWindow = new ListPlainOptionsWindow(optionListData);
                        this.speechSyn.SpeakAsync(optionListData.Opening);
                        this.listPlainOptionWindow.Owner = this;
                        this.listPlainOptionWindow.Show();
                        this.listPlainOptionWindow.Closed += this.OnlistPlainOptionWindowClosed;
                    }
                    break;

                case DialogueResponseType.listMapLayerOptions:
                    MapLayerOptionListData optionListData2 = resp.RespContent as MapLayerOptionListData;
                    if (optionListData2 != null)
                    {
                        this.listMapLayerOptionWindow = new ListMapLayerOptionsWindow(optionListData2);
                        this.speechSyn.SpeakAsync(optionListData2.Opening);
                        this.listMapLayerOptionWindow.Show();
                        this.listMapLayerOptionWindow.Owner   = this;
                        this.listMapLayerOptionWindow.Closed += this.OnlistMapLayerOptionWindowClosed;
                        this.listMapLayerOptionWindow.LoadMap(mapMgr.GetMapFile());
                    }
                    break;

                case DialogueResponseType.listOptionsWithExamples:
                    OptionWithExampleListData optionListData3 = resp.RespContent as OptionWithExampleListData;
                    if (optionListData3 != null)
                    {
                        this.listOptionsWithExampleWindow = new ListOptionsWithExamplesWindow(optionListData3);
                        this.speechSyn.SpeakAsync(optionListData3.Opening);
                        this.listOptionsWithExampleWindow.Owner = this;
                        this.listOptionsWithExampleWindow.Show();
                        this.listOptionsWithExampleWindow.Closed += this.OnlistOptionsWithExampleWindowClosed;
                    }
                    break;

                case DialogueResponseType.drawPolygonStarted:
                    mapMgr.DrawPolygon(resp.RespContent.ToString());
                    break;

                case DialogueResponseType.selectByAttributes:
                    if (mapMgr != null)
                    {
                        SelectByAttributeWindow selectWindow = new SelectByAttributeWindow(mapMgr);
                        selectWindow.Show();
                        selectWindow.Owner   = this;
                        selectWindow.Closed += this.OnSelectByAttributeWindowClosed;
                    }
                    break;

                case DialogueResponseType.statisticResults:
                    Hashtable statResults = resp.RespContent as Hashtable;
                    if (statResults != null)
                    {
                        this.statResultsWindow       = new StatResultsWindow(statResults);
                        this.statResultsWindow.Owner = this;
                        this.statResultsWindow.Show();
                    }
                    break;

                case DialogueResponseType.summaryResults:
                    Hashtable sumResults = resp.RespContent as Hashtable;
                    if (sumResults != null)
                    {
                        this.sumResultsWindow       = new SummaryResultsWindow(sumResults);
                        this.sumResultsWindow.Owner = this;
                        this.sumResultsWindow.Show();
                    }
                    break;

                case DialogueResponseType.debugError:
                    Log(resp.RespContent.ToString(), "error");
                    break;

                case DialogueResponseType.debugInfo:
                    Log(resp.RespContent.ToString(), "info");
                    break;

                case DialogueResponseType.debugWarning:
                    Log(resp.RespContent.ToString(), "warning");
                    break;

                default:
                    break;
                }
            }
        }