ToString() public method

public ToString ( ) : string
return string
Beispiel #1
0
        // This sets up the panel for a specific day
        public void SetupDay(DateTime day)
        {
            thisday = day;

            string datestr = day.ToLongDateString();

            datelabel.Text = datestr.Replace(",", " ").ToUpper();
            Deselect();

            // Determine begin and end date for this day
            DateTime dstart = new DateTime(day.Year, day.Month, day.Day);
            DateTime dend   = new DateTime(dstart.Year, dstart.Month, dstart.Day);

            dend = dend.AddDays(1);
            dend = dend.AddTicks(-1);

            // Setup items
            List <AgendaItem> items = General.Agenda.GetItems(dstart, dend);

            for (int i = 0; i < NUM_ITEMS; i++)
            {
                // Within range of items or this day?
                if (i < items.Count)
                {
                    AgendaItem ditem   = items[i];
                    DateTime   itemend = ditem.startdate + ditem.duration;
                    itemlabels[i].Text       = ditem.startdate.Hour + ":" + ditem.startdate.Minute.ToString("00") + "      -";
                    itemlabels[i].Visible    = true;
                    itemends[i].Text         = itemend.Hour + ":" + itemend.Minute.ToString("00");
                    itemends[i].Visible      = true;
                    itembuttons[i].Text      = ditem.ToString();
                    itembuttons[i].ColorText = ditem.color;
                    itembuttons[i].SetupColors(General.Colors);
                    itembuttons[i].Tag     = ditem;
                    itembuttons[i].Visible = true;
                }
                else
                {
                    itembuttons[i].Tag     = null;
                    itemlabels[i].Visible  = false;
                    itembuttons[i].Visible = false;
                    itemends[i].Visible    = false;
                }
            }
        }
Beispiel #2
0
        // Update and animate items at the top
        private void animatetoptimer_Tick(object sender, EventArgs e)
        {
            animatetoptimer.Stop();

            if (agendaupdateneeded)
            {
                UpdateAgenda();
            }

            if (notesupdateneeded)
            {
                UpdateNotes();
            }

            // A negative value means we must clear the list
            if (agendadisplayindex < 0)
            {
                agendaitemindex   = 0;
                lastagendaitemday = 0;
                for (int i = 0; i < NUM_AGENDA_ITEMS; i++)
                {
                    agendaitems[i].Visible = false;
                    agendatimes[i].Visible = false;
                }
            }

            // A negative value means we must clear the list
            if (notesitemindex < 0)
            {
                for (int i = 0; i < NUM_NOTES_ITEMS; i++)
                {
                    notesitems[i].Visible = false;
                }
            }

            // We animate in sequence: We do the agenda items first, then the notes.
            if ((agendadata != null) && (agendadisplayindex < NUM_AGENDA_ITEMS))
            {
                // Show next item?
                if (agendadisplayindex >= 0)
                {
                    if (agendaitemindex < agendadata.Count)
                    {
                        // Setup time
                        AgendaItem itemdata = agendadata[agendaitemindex];
                        if (itemdata.startdate.Day != lastagendaitemday)
                        {
                            // Use an item for the date
                            if (agendadisplayindex < (NUM_AGENDA_ITEMS - 1))
                            {
                                lastagendaitemday = itemdata.startdate.Day;

                                // Time
                                agendatimes[agendadisplayindex].Text      = " ";
                                agendatimes[agendadisplayindex].ColorText = ColorIndex.ControlColor4;
                                agendatimes[agendadisplayindex].SetupColors(General.Colors);
                                agendatimes[agendadisplayindex].Visible = true;

                                // Description
                                if (lastagendaitemday == DateTime.Today.Day)
                                {
                                    agendaitems[agendadisplayindex].Text = "Today";
                                }
                                else
                                {
                                    agendaitems[agendadisplayindex].Text = itemdata.startdate.ToString("dddd, MMMM d");
                                }
                                agendaitems[agendadisplayindex].ColorText = ColorIndex.ControlColor4;
                                agendaitems[agendadisplayindex].SetupColors(General.Colors);
                                agendaitems[agendadisplayindex].Visible = true;
                            }

                            agendadisplayindex++;
                        }

                        if (agendadisplayindex < NUM_AGENDA_ITEMS)
                        {
                            // Time
                            if (itemdata.recur == AgendaItemRecur.Annually)
                            {
                                agendatimes[agendadisplayindex].Text = "-";
                            }
                            else
                            {
                                agendatimes[agendadisplayindex].Text = itemdata.startdate.Hour + ":" + itemdata.startdate.Minute.ToString("00");
                            }
                            agendatimes[agendadisplayindex].ColorText = ColorIndex.ControlColor3;
                            agendatimes[agendadisplayindex].SetupColors(General.Colors);
                            agendatimes[agendadisplayindex].Visible = true;

                            // Description
                            agendaitems[agendadisplayindex].Text      = itemdata.ToString();
                            agendaitems[agendadisplayindex].ColorText = itemdata.color;
                            agendaitems[agendadisplayindex].SetupColors(General.Colors);
                            agendaitems[agendadisplayindex].Visible = true;
                        }
                    }
                    else
                    {
                        // No item
                        agendaitems[agendadisplayindex].Visible = false;
                        agendatimes[agendadisplayindex].Visible = false;
                    }

                    agendaitemindex++;
                }

                agendadisplayindex++;
                animatetoptimer.Interval = 100;
            }
            else if ((notesdata != null) && (notesitemindex < notesdata.Count) && (notesitemindex < NUM_NOTES_ITEMS))
            {
                // Show next item?
                if (notesitemindex >= 0)
                {
                    int toppos;
                    if (notesitemindex == 0)
                    {
                        toppos = noteitem1.Top;
                    }
                    else
                    {
                        toppos = notesitems[notesitemindex - 1].Bottom + noteitemspacing;
                    }

                    if (toppos - noteitemspacing < noteitem10.Bottom)
                    {
                        string text = notesdata[notesitemindex].note;
                        text = text.Replace("\n", "\n    ");
                        notesitems[notesitemindex].AutoSizeHeight = true;
                        notesitems[notesitemindex].Top            = toppos;
                        notesitems[notesitemindex].Text           = "•  " + text;
                        notesitems[notesitemindex].Visible        = true;
                        if (notesitems[notesitemindex].Bottom > noteitem10.Bottom)
                        {
                            notesitems[notesitemindex].AutoSizeHeight = false;
                            notesitems[notesitemindex].Height         = noteitem10.Bottom - notesitems[notesitemindex].Top;

                            // End animation
                            notesitemindex += 999999;
                        }
                    }
                    else
                    {
                        // End animation
                        notesitemindex += 999999;
                    }
                }

                notesitemindex++;
                animatetoptimer.Interval = 100;
            }
            // Animation ended?
            else
            {
                // Set the timer to restart later
                agendadisplayindex       = -5;
                notesitemindex           = -1;
                animatetoptimer.Interval = 10000;
            }

            animatetoptimer.Start();
        }