wp7记事本源代码

原创 2012年03月27日 19:40:03

先上效果图


这个记事本操作简便,功能强大,在记事本的基础上添加了将内容发送短信和发送邮件的功能。这个应用也已经功过了微软的认证。115网盘里面的是最新的。
QQ:29992379
下载地址:
http://115.com/file/e7bxlvs9# 
Memo.xap

实体类

public class Note
{
	public string NoteGuid { get; set; }
	public string NoteContent { get; set; }
	public string NoteTime { get; set; }
}

在独立存储中生成存储结构。

if (!IsolatedStorageSettings.ApplicationSettings.Contains("Notes"))
{
	List<Note> notes = new List<Note>();
	IsolatedStorageSettings.ApplicationSettings["Notes"] = notes as List<Note>;
	IsolatedStorageSettings.ApplicationSettings.Save();

}

绑定文章的列表,并按编号使用linq倒排序。

public partial class MainPage : PhoneApplicationPage
    {
        // 构造函数
        public MainPage()
        {
            InitializeComponent();
            BingData();
        }
        List<Note> notes = new List<Note>();
        private void BingData()
        {
            notes = IsolatedStorageSettings.ApplicationSettings["Notes"] as List<Note>;

            var descInfo = from i in notes orderby i.NoteTime descending select i;

            MainListBox.ItemsSource = descInfo;
        }

        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/Add.xaml", UriKind.RelativeOrAbsolute));
        }

        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            App.Quit();
            base.OnBackKeyPress(e);
        }

        private void ApplicationBarIconButton_Click_1(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/About.xaml", UriKind.RelativeOrAbsolute));
        }

        private void StackPanel_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            string noteguid = ((TextBlock)(((StackPanel)sender).Children.First())).Tag.ToString();
            NavigationService.Navigate(new Uri("/DetailsPage.xaml?noteguid=" + noteguid, UriKind.Relative));
        }
    }

文章显示的页面以及一系列功能

public partial class DetailsPage : PhoneApplicationPage
    {
        // 构造函数
        public DetailsPage()
        {
            InitializeComponent();
        }
        string noteguid;
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            BingData();
            noteguid = NavigationContext.QueryString["noteguid"].ToString();
            foreach (var item in notes)
            {
                if (item.NoteGuid==noteguid)
                {
                    ContentText.Text = item.NoteContent;
                    TimeText.Text = item.NoteTime;
                    return;
                }
            }
        }

        List<Note> notes = new List<Note>();
        private void BingData()
        {
            notes = IsolatedStorageSettings.ApplicationSettings["Notes"] as List<Note>;
        }

        private void Edit_Click(object sender, EventArgs e)
        {
            NavigationService.Navigate(new Uri("/Edit.xaml?noteguid=" + noteguid.ToString(), UriKind.RelativeOrAbsolute));
        }

        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
            base.OnBackKeyPress(e);
        }
	//删除
        private void Del_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < notes.Count; i++)
            {
                if (notes[i].NoteGuid==noteguid)
                {
                    notes.RemoveAt(i);
                }
            }
            IsolatedStorageSettings.ApplicationSettings["Notes"] = notes as List<Note>;
            IsolatedStorageSettings.ApplicationSettings.Save();
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
        }
	//发送邮件
        private void Email_Click(object sender, EventArgs e)
        {
            EmailComposeTask email = new EmailComposeTask();
            email.Body = ContentText.Text.ToString();
            email.Show();
        }
	//发送短信
        private void Message_Click(object sender, EventArgs e)
        {
            SmsComposeTask sms = new SmsComposeTask();
            sms.Body = ContentText.Text.ToString();
            sms.Show();
        }
    }
文章的编辑页面代码
 public partial class Edit : PhoneApplicationPage
    {
        public Edit()
        {
            InitializeComponent();
        }

        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            foreach (var item in notes)
            {
                if (item.NoteGuid == noteguid)
                {
                    item.NoteContent = ContentText.Text;
                    item.NoteTime=TimeText.Text;
                }
            }

            IsolatedStorageSettings.ApplicationSettings["Notes"] = notes as List<Note>;
            IsolatedStorageSettings.ApplicationSettings.Save();
            NavigationService.Navigate(new Uri("/DetailsPage.xaml?noteguid=" + noteguid.ToString(), UriKind.RelativeOrAbsolute));
        }
        string noteguid;
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            BingData();
            noteguid = NavigationContext.QueryString["noteguid"].ToString();
            foreach (var item in notes)
            {
                if (item.NoteGuid==noteguid)
                {
                    ContentText.Text = item.NoteContent;
                    TimeText.Text = item.NoteTime;
                    return;
                }
            }
        }

        List<Note> notes = new List<Note>();
        private void BingData()
        {
            notes = IsolatedStorageSettings.ApplicationSettings["Notes"] as List<Note>;
        }
    }

原文地址:http://www.cnblogs.com/wildfeng/archive/2012/03/23/2412071.html

WP7 QRCODE源代码

  • 2012年04月11日 17:15
  • 198KB
  • 下载

wp7天气预报源代码下载

  • 2012年03月25日 09:44
  • 15.66MB
  • 下载

wp7天气预报源代码(四UI的制作)视觉状态

讲讲 wp7开发 本次讲城市列表中控件的制作。 此控件为用户自定义控件。制作布局和上一章讲的ForecastTile控件一样,只是在其基础上增加了视觉状态。 为3个状态添加了效果和...

wp7源代码、c#、界面

  • 2012年03月27日 12:55
  • 4.98MB
  • 下载

wp7手机归属地查询源代码

废话不多说先上效果图 应用地址:http://115.com/file/dp7nnu54# SearchPhone.xap大家可以去下载。这个应用已经通过了微软的认证。 此应用拥有3个功能,...

wp7天气预报源代码(三UI的制作)下载地址更新

天气预报的部分代码公布到了博客后,很多网友就要求喜欢能下载到整个项目。昨天早上把源代码传到了csdn,晚上写了一篇博文介绍序列化谷歌数据的工具类,顺便把整个项目的源代码下载地址加上了。 很多网友...

05-wp7版简易计算器

1.效果演示: 2.目录结构 3.代码 MainPage.xaml
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:wp7记事本源代码
举报原因:
原因补充:

(最多只允许输入30个字)