Ejemplo n.º 1
0
        public override void ShowSettingForm()
        {
            SettingForm settingForm = new SettingForm(this);

            settingForm.ShowDialog();
            settingForm.Dispose();
        }
Ejemplo n.º 2
0
        public override void CreatedHeadlineByManual()
        {
            base.CreatedHeadlineByManual();

            // RSS URLを入力するように促す
            MessageBox.Show(messagesResource.GetString("PleaseInputRssUrl"), messagesResource.GetString("Infomation"), MessageBoxButtons.OK,
                            MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            SettingForm settingForm = new SettingForm(this);

            settingForm.ShowDialogAndFocusRssUrl();
            settingForm.Dispose();

            // ヘッドライン名が空の場合は、自動でPodcastのタイトルを取得する
            if (Setting.Name == string.Empty)
            {
                Stream    st     = null;
                XmlReader reader = null;
                try
                {
                    // itemタグの中にいるか
                    bool inItemFlag = false;

                    st     = connectionSetting.CreateStream(Setting.RssUrl);
                    reader = new XmlTextReader(st);

                    while (reader.Read())
                    {
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            if (reader.LocalName == "title" && inItemFlag == false)
                            {
                                Setting.Name = reader.ReadString();
                                break;
                            }
                            if (reader.LocalName == "item")
                            {
                                inItemFlag = true;
                            } // End of item
                        }
                        else if (reader.NodeType == XmlNodeType.EndElement)
                        {
                            if (reader.LocalName == "item")
                            {
                                inItemFlag = false;
                            }
                        }
                    }
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Close();
                    }
                    if (st != null)
                    {
                        st.Close();
                    }
                }
            }
        }