Пример #1
0
 private void setName_TextChanged(object sender, System.EventArgs e)
 {
     if (_clips == null)
     {
         _clips = new Clips();
     }
     _clips.Name = setName.Text;
 }
Пример #2
0
 public Clips Load(string filename)
 {
     System.Xml.XmlTextReader xtw = new System.Xml.XmlTextReader(filename);
     try
     {
         Clips clips = (Clips)s_ser.Deserialize(xtw);
         return(clips);
     }
     finally
     {
         xtw.Close();
     }
 }
Пример #3
0
 public void Save(Clips clips, string filename)
 {
     System.Xml.XmlTextWriter xtw = new System.Xml.XmlTextWriter(filename, System.Text.Encoding.UTF8);
     try
     {
         xtw.Formatting = System.Xml.Formatting.Indented;
         s_ser.Serialize(xtw, clips, s_xsn);
     }
     finally
     {
         xtw.Close();
     }
 }
Пример #4
0
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            if (this._clips == null)
            {
                this._clips = new Clips();
            }

            Clip c = new Clip(this.getGoodNewClipName());

            this._clips.TextClips.Add(c);
            this.lstClips.Items.Add(c);
            this.lstClips.SelectedItem = c;
        }
Пример #5
0
        private void itmNew_Click(object sender, System.EventArgs e)
        {
            if (this.CheckModified() == true)
            {
                this._changing = true;
                this.lstClips.Items.Clear();
                this.txtClipName.Text = "";
                this.txtClipText.Text = "";
                this.setName.Text     = "";
                this._filename        = "";
                this._clips           = null;
                this._changing        = false;

                this.enableButtons(false);
            }
        }
Пример #6
0
        private void itmOpen_Click(object sender, System.EventArgs e)
        {
            if (this.CheckModified() == true &&
                this.openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                this._changing = true;
                this.lstClips.Items.Clear();
                this.enableButtons(false);
                this.txtClipName.Text = "";
                this.txtClipText.Text = "";
                this.setName.Text     = "";
                this._filename        = "";
                this._clips           = null;

                Clips clips = null;
                try
                {
                    clips = this._cs.Load(this.openFileDialog.FileName);
                }
                catch (Exception)
                {
                }

                if (clips != null)
                {
                    this._clips = clips;
                    foreach (Clip c in this._clips.TextClips)
                    {
                        this.lstClips.Items.Add(c);
                    }

                    this.setName.Text = clips.Name;

                    this._filename = this.openFileDialog.FileName;
                }

                this._changing = false;

                this.enableButtons(false);
            }
        }
Пример #7
0
		private void itmNew_Click(object sender, System.EventArgs e)
		{
			if (CheckModified() == true)
			{
				_changing = true;
				lstClips.Items.Clear();
				txtClipName.Text = "";
				txtClipText.Text = "";
				setName.Text = "";
				_filename = "";
				_clips = null;
				_changing = false;

				enableButtons(false);
			}
		}
Пример #8
0
		private void setName_TextChanged(object sender, System.EventArgs e)
		{
			if(_clips == null)
				_clips = new Clips();
			_clips.Name = setName.Text;
		}
Пример #9
0
		private void btnAdd_Click(object sender, System.EventArgs e)
		{
			if(_clips == null)
				_clips = new Clips();

			Clip c = new Clip(getGoodNewClipName());
			_clips.TextClips.Add(c);
			lstClips.Items.Add(c);
			lstClips.SelectedItem = c;
		}
Пример #10
0
		private void itmOpen_Click(object sender, System.EventArgs e)
		{
			if (CheckModified() == true &&
				openFileDialog.ShowDialog(this) == DialogResult.OK)
			{
				_changing = true;
				lstClips.Items.Clear();
				enableButtons(false);
				txtClipName.Text = "";
				txtClipText.Text = "";
				setName.Text = "";
				_filename = "";
				_clips = null;

				Clips clips = null;
				try
				{
					clips = _cs.Load(openFileDialog.FileName);
				}
				catch(Exception)
				{
				}

				if(clips != null)
				{
					_clips = clips;
					foreach(Clip c in _clips.TextClips)
					{
						lstClips.Items.Add(c);
					}
					
					setName.Text = clips.Name;

					_filename = openFileDialog.FileName;
				}				

				_changing = false;

				enableButtons(false);
			}
		}
Пример #11
0
		public void Save(Clips clips, string filename)
		{
			System.Xml.XmlTextWriter xtw = new System.Xml.XmlTextWriter(filename, System.Text.Encoding.UTF8);
			try
			{
				xtw.Formatting = System.Xml.Formatting.Indented;
				s_ser.Serialize(xtw, clips, s_xsn);
			}
			finally
			{
				xtw.Close();
			}
		}