Exemple #1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType != typeof (string)) return base.ConvertTo(context, culture, value, destinationType);
            var note = value as PNote;
            if (note == null) return "";
            var bt = new StringBuilder();
            var dtc = new DateTimeConverter();
            var szc = new SizeConverter();
            var scd = new System.Drawing.SizeConverter();
            var ptc = new PointConverter();
            var scv = new ScheduleConverter();
            var skc = new SkinlessConverter();
            var sb = new StringBuilder();

            sb.Append(note.Changed);
            sb.Append(DEL_NOTE);
            sb.Append(note.Completed);
            sb.Append(DEL_NOTE);
            sb.Append(note.CustomOpacity);
            sb.Append(DEL_NOTE);
            sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, note.DateCreated));
            sb.Append(DEL_NOTE);
            sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, note.DateDeleted));
            sb.Append(DEL_NOTE);
            sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, note.DateReceived));
            sb.Append(DEL_NOTE);
            sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, note.DateSaved));
            sb.Append(DEL_NOTE);
            sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, note.DateSent));
            sb.Append(DEL_NOTE);
            sb.Append((int)note.DockStatus);
            sb.Append(DEL_NOTE);
            sb.Append(scd.ConvertToString(null, PNStatic.CultureInvariant, note.EditSize));
            sb.Append(DEL_NOTE);
            sb.Append(note.Favorite);
            sb.Append(DEL_NOTE);
            sb.Append(note.FromDB);
            sb.Append(DEL_NOTE);
            sb.Append(note.GroupID);
            sb.Append(DEL_NOTE);
            sb.Append(note.ID);
            sb.Append(DEL_NOTE);
            foreach (var s in note.LinkedNotes)
            {
                bt.Append(s);
                bt.Append(DEL_INNER);
            }
            if (bt.Length > 0)
                bt.Length -= 1;
            sb.Append(bt);
            sb.Append(DEL_NOTE);
            sb.Append(note.Name);
            sb.Append(DEL_NOTE);
            sb.Append(ptc.ConvertToString(null, PNStatic.CultureInvariant, note.NoteLocation));
            sb.Append(DEL_NOTE);
            sb.Append(szc.ConvertToString(null, PNStatic.CultureInvariant, note.NoteSize));
            sb.Append(DEL_NOTE);
            sb.Append(note.Opacity.ToString(PNStatic.CultureInvariant));
            sb.Append(DEL_NOTE);
            sb.Append(note.PasswordString);
            sb.Append(DEL_NOTE);
            sb.Append(note.Pinned);
            sb.Append(DEL_NOTE);
            sb.Append(note.PrevGroupID);
            sb.Append(DEL_NOTE);
            sb.Append(note.Priority);
            sb.Append(DEL_NOTE);
            sb.Append(note.Protected);
            sb.Append(DEL_NOTE);
            sb.Append(note.ReceivedFrom);
            sb.Append(DEL_NOTE);
            sb.Append(note.Rolled);
            sb.Append(DEL_NOTE);
            sb.Append(scv.ConvertToString(note.Schedule));
            sb.Append(DEL_NOTE);
            sb.Append((int)note.SentReceived);
            sb.Append(DEL_NOTE);
            sb.Append(note.SentTo);
            sb.Append(DEL_NOTE);
            sb.Append(note.Skin != null ? note.Skin.SkinName : "");
            sb.Append(DEL_NOTE);
            sb.Append(note.Skinless != null ? skc.ConvertToString(note.Skinless) : "");
            sb.Append(DEL_NOTE);
            bt = new StringBuilder();
            foreach (var s in note.Tags)
            {
                bt.Append(s);
                bt.Append(DEL_INNER);
            }
            if (bt.Length > 0)
                bt.Length -= 1;
            sb.Append(bt);
            sb.Append(DEL_NOTE);
            sb.Append(note.Topmost);
            sb.Append(DEL_NOTE);
            sb.Append(note.Visible);
            sb.Append(DEL_NOTE);
            sb.Append(note.XFactor.ToString(PNStatic.CultureInvariant));
            sb.Append(DEL_NOTE);
            sb.Append(note.YFactor.ToString(PNStatic.CultureInvariant));
            sb.Append(DEL_NOTE);
            sb.Append(note.PinClass);
            sb.Append(DEL_NOTE);
            sb.Append(note.PinText);
            return sb.ToString();
        }
Exemple #2
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                if (value == null)
                {
                    return "";
                }
                var sch = value as PNNoteSchedule;
                if (sch != null)
                {
                    var dwc = new DaysOfWeekConverter();
                    var mc = new MonthDayConverter();
                    var avc = new AlarmAfterValuesConverter();
                    var dtc = new DateTimeConverter();

                    var sb = new StringBuilder();
                    sb.Append(avc.ConvertToString(sch.AlarmAfter));
                    sb.Append(DEL_INNER);
                    sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, sch.AlarmDate));
                    sb.Append(DEL_INNER);
                    sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, sch.LastRun));
                    sb.Append(DEL_INNER);
                    sb.Append(mc.ConvertToString(sch.MonthDay));
                    sb.Append(DEL_INNER);
                    sb.Append(sch.RepeatCount);
                    sb.Append(DEL_INNER);
                    sb.Append(sch.Sound);
                    sb.Append(DEL_INNER);
                    sb.Append(sch.SoundInLoop);
                    sb.Append(DEL_INNER);
                    sb.Append(dtc.ConvertToString(null, PNStatic.CultureInvariant, sch.StartDate));
                    sb.Append(DEL_INNER);
                    sb.Append((int)sch.StartFrom);
                    sb.Append(DEL_INNER);
                    sb.Append(sch.StopAfter);
                    sb.Append(DEL_INNER);
                    sb.Append(sch.Track);
                    sb.Append(DEL_INNER);
                    sb.Append((int)sch.Type);
                    sb.Append(DEL_INNER);
                    sb.Append(sch.UseTts);
                    sb.Append(DEL_INNER);
                    sb.Append(dwc.ConvertToString(sch.Weekdays));
                    sb.Append(DEL_INNER);
                    sb.Append(sch.ProgramToRunOnAlert);
                    sb.Append(DEL_INNER);
                    sb.Append(sch.CloseOnNotification);
                    return sb.ToString();
                }
            }
            return base.ConvertTo(context, culture, value, destinationType);
        }
Exemple #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            string s = "";
            if (comboBox1.SelectedIndex == 0)
            {
                s+="extensao ";
                if (comboBox2.SelectedIndex == 0)
                    s += "= ";
                else s += "!= ";

                s += textBox4.Text;
            }

            if (comboBox1.SelectedIndex == 1)
            {
                s += "tamanho ";
                if (comboBox2.SelectedIndex == 0)
                    s += "< ";
                else s += "> ";

                s += numericUpDown1.Value.ToString();
            }

            if (comboBox1.SelectedIndex == 2)
            {
                s += "data ";
                if (comboBox2.SelectedIndex == 0)
                    s += "> ";
                else s += "< ";

                DateTimeConverter d = new DateTimeConverter();
                string temp;
                temp = d.ConvertToString(dateTimePicker1.Value.Date);
                s += temp;
            }

            if (comboBox1.SelectedIndex == 3)
            {
                s += "nome ";
                s += "contem ";
                s += textBox4.Text;
            }

            listBox1.Items.Add(s);

            if (comboBox1.SelectedIndex == 0)
                if (textBox4.Text != null)
                    actualizar_combo_extensoes(textBox4.Text);
        }