コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: cdbean/CAGA
 public MainWindow()
 {
     InitializeComponent();
     openFileDlg = new Microsoft.Win32.OpenFileDialog();
     listPlainOptionWindow = null;
     listMapLayerOptionWindow = null;
     listOptionsWithExampleWindow = null;
     statResultsWindow = null;
     sumResultsWindow = null;
 }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: cdbean/CAGA
        void Process_Response(ArrayList respList)
        {
            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)
            {
                if (resp.DlgRespType == DialogueResponseType.speechError)
                {
                    speechSyn.SpeakAsync(resp.RespContent.ToString());
                    Log(resp.RespContent.ToString(), "error");
                }
                else if (resp.DlgRespType == DialogueResponseType.speechInfo)
                {
                    speechSyn.SpeakAsync(resp.RespContent.ToString());
                    Log(resp.RespContent.ToString(), "info");
                }
                else if (resp.DlgRespType == DialogueResponseType.speechQuestion)
                {
                    speechSyn.SpeakAsync(resp.RespContent.ToString());
                    Log("Question: " + resp.RespContent.ToString(), "info");
                }
                else if (resp.DlgRespType == DialogueResponseType.mapLayerAdded)
                {
                    mapMgr.AddLayer(resp.RespContent.ToString());
                    Log("A new map layer is added: " + resp.RespContent.ToString(), "info");
                }
                else if (resp.DlgRespType == DialogueResponseType.mapLayerRemoved)
                {
                    mapMgr.HideLayer(resp.RespContent.ToString());
                    Log("A new map layer is hidden: " + resp.RespContent.ToString(), "info");
                }
                else if (resp.DlgRespType == DialogueResponseType.mapDocumentOpened)
                {
                    mapMgr.LoadMap(resp.RespContent.ToString());
                    Log("A new map document is opened: " + resp.RespContent.ToString(), "info");
                }
                else if (resp.DlgRespType == 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;
                    }
                }

                else if (resp.DlgRespType == DialogueResponseType.listMapLayerOptions)
                {
                    MapLayerOptionListData optionListData = resp.RespContent as MapLayerOptionListData;
                    if (optionListData != null)
                    {
                        this.listMapLayerOptionWindow = new ListMapLayerOptionsWindow(optionListData);
                        this.speechSyn.SpeakAsync(optionListData.Opening);
                        this.listMapLayerOptionWindow.Show();
                        this.listMapLayerOptionWindow.Owner = this;
                        this.listMapLayerOptionWindow.Closed += this.OnlistMapLayerOptionWindowClosed;
                        this.listMapLayerOptionWindow.LoadMap(mapMgr.GetMapFile());
                    }
                }
                else if (resp.DlgRespType == DialogueResponseType.listOptionsWithExamples)
                {
                    OptionWithExampleListData optionListData = resp.RespContent as OptionWithExampleListData;
                    if (optionListData != null)
                    {
                        this.listOptionsWithExampleWindow = new ListOptionsWithExamplesWindow(optionListData);
                        this.speechSyn.SpeakAsync(optionListData.Opening);
                        this.listOptionsWithExampleWindow.Owner = this;
                        this.listOptionsWithExampleWindow.Show();
                        this.listOptionsWithExampleWindow.Closed += this.OnlistOptionsWithExampleWindowClosed;
                    }
                }
                else if (resp.DlgRespType == DialogueResponseType.drawPolygonStarted)
                {
                    mapMgr.DrawPolygon(resp.RespContent.ToString());
                }
                else if (resp.DlgRespType == DialogueResponseType.selectByAttributes)
                {
                    if (mapMgr != null)
                    {
                        SelectByAttributeWindow selectWindow = new SelectByAttributeWindow(mapMgr);
                        selectWindow.Show();
                        selectWindow.Owner = this;
                        selectWindow.Closed += this.OnSelectByAttributeWindowClosed;
                    }
                }
                else if (resp.DlgRespType == DialogueResponseType.statisticResults)
                {
                    Hashtable statResults = resp.RespContent as Hashtable;
                    if (statResults != null)
                    {
                        this.statResultsWindow = new StatResultsWindow(statResults);
                        this.statResultsWindow.Owner = this;
                        this.statResultsWindow.Show();
                    }
                }
                else if (resp.DlgRespType == DialogueResponseType.summaryResults)
                {
                    Hashtable sumResults = resp.RespContent as Hashtable;
                    if (sumResults != null)
                    {
                        this.sumResultsWindow = new SummaryResultsWindow(sumResults);
                        this.sumResultsWindow.Owner = this;
                        this.sumResultsWindow.Show();
                    }
                }
                else if (resp.DlgRespType == DialogueResponseType.debugError)
                {
                    Log(resp.RespContent.ToString(), "error");
                }
                else if (resp.DlgRespType == DialogueResponseType.debugInfo)
                {
                    Log(resp.RespContent.ToString(), "info");
                }
                else if (resp.DlgRespType == DialogueResponseType.debugWarning)
                {
                    Log(resp.RespContent.ToString(), "warning");
                }
            }
        }