Ejemplo n.º 1
0
 private void editDescription_TextChanged(object sender, EventArgs e)
 {
     if (this.currentItem != null)
     {
         ToDo.Item tag = this.currentItem.Tag as ToDo.Item;
         tag.Description = this.editDescription.Text;
         this.currentItem.SubItems[5].Text = tag.Description.Replace("\n", "  ");
         if (tag.State == ToDo.State.DONE)
         {
             this.setState(this.currentItem, ToDo.State.UPDATED);
         }
         this.nav.HasChanges = true;
     }
 }
Ejemplo n.º 2
0
        private void addListItem(string key, ToDo.Item data)
        {
            string       str          = (data.item == null ? key : data.item.Name);
            itemType     _itemType    = (data.item == null ? itemType.NULL_ITEM : data.item.type);
            ListViewItem listViewItem = this.listView.Items.Add(key, str, 0);

            listViewItem.SubItems.Add(_itemType.ToString());
            listViewItem.SubItems.Add(data.State.ToString());
            listViewItem.SubItems.Add(data.Priority.ToString());
            listViewItem.SubItems.Add(this.assignList[data.Assigned]);
            if (data.Description != null)
            {
                listViewItem.SubItems.Add(data.Description.Replace("\n", "  "));
            }
            listViewItem.Tag = data;
        }
Ejemplo n.º 3
0
        private void listView_SelectedIndexChanged(object sender, EventArgs e)
        {
            Size clientSize;

            this.currentItem = null;
            if (this.listView.SelectedItems.Count != 1)
            {
                this.editDescription.Text      = "";
                this.lockedDescription.Visible = false;
                this.editDescription.ReadOnly  = true;
                TextBox height = this.editDescription;
                clientSize               = this.editDescription.Parent.ClientSize;
                height.Height            = clientSize.Height;
                this.editDescription.Top = 0;
                return;
            }
            ToDo.Item tag = this.listView.SelectedItems[0].Tag as ToDo.Item;
            if (tag.locked.description != null)
            {
                this.lockedDescription.Visible = true;
                this.lockedDescription.Text    = tag.locked.description;
                Size size = TextRenderer.MeasureText(this.lockedDescription.Text, this.lockedDescription.Font);
                this.lockedDescription.Height = size.Height + 8;
                TextBox textBox = this.editDescription;
                clientSize               = this.editDescription.Parent.ClientSize;
                textBox.Height           = clientSize.Height - this.lockedDescription.Height;
                this.editDescription.Top = this.lockedDescription.Height + 4;
            }
            else
            {
                this.lockedDescription.Visible = false;
                TextBox height1 = this.editDescription;
                clientSize               = this.editDescription.Parent.ClientSize;
                height1.Height           = clientSize.Height;
                this.editDescription.Top = 0;
            }
            this.editDescription.Text     = (tag.active == null || tag.active.description == null ? "" : tag.active.description);
            this.editDescription.ReadOnly = false;
            this.currentItem = this.listView.SelectedItems[0];
            this.editDescription.Focus();
        }
Ejemplo n.º 4
0
        public void AddItem(GameData.Item target, string description = "")
        {
            ToDo.Item item;
            if (this.items.ContainsKey(target.stringID))
            {
                item = this.items[target.stringID];
                if (item.active.description != null)
                {
                    ToDo.SubItem subItem = item.active;
                    subItem.description = string.Concat(subItem.description, description);
                }
                else
                {
                    item.Description = "";
                }
                if (!this.listView.Items.ContainsKey(target.stringID))
                {
                    this.addListItem(target.stringID, item);
                }
            }
            else
            {
                item = new ToDo.Item();
                this.items[target.stringID] = item;
                item.Description            = description;
                item.item = target;
                this.addListItem(target.stringID, item);
                this.nav.HasChanges = true;
            }
            base.Show();
            this.listView.SelectedItems.Clear();
            int num = this.listView.Items.IndexOfKey(target.stringID);

            this.listView.EnsureVisible(num);
            this.listView.Items[num].Selected = true;
        }
Ejemplo n.º 5
0
        public void LoadData(string file, bool active)
        {
            ToDo.Item item;
            string    str;

            if (active)
            {
                this.activeFile = file;
            }
            if (File.Exists(file))
            {
                StreamReader streamReader = new StreamReader(file);
                string       str1         = streamReader.ReadLine();
                List <int>   nums         = null;
                if (str1 != null && str1.StartsWith("MODS: "))
                {
                    nums = new List <int>();
                    string[] strArrays = str1.Substring(6).Split(new char[] { ',' });
                    for (int i = 0; i < (int)strArrays.Length; i++)
                    {
                        string str2 = strArrays[i];
                        if (!this.assignList.Contains(str2))
                        {
                            this.assignList.Add(str2);
                        }
                        nums.Add(this.assignList.IndexOf(str2));
                    }
                }
                while (true)
                {
                    string str3 = streamReader.ReadLine();
                    str1 = str3;
                    if (str3 == null)
                    {
                        break;
                    }
                    int num = str1.IndexOf("||");
                    if (num > 0)
                    {
                        str = str1.Substring(num + 2);
                    }
                    else
                    {
                        str = null;
                    }
                    string   str4       = str;
                    string[] strArrays1 = (num > 0 ? str1.Substring(0, num).Split(new char[] { '|' }) : str1.Split(new char[] { '|' }));
                    if (!this.items.ContainsKey(strArrays1[0]))
                    {
                        Dictionary <string, ToDo.Item> strs = this.items;
                        string    str5  = strArrays1[0];
                        ToDo.Item item1 = new ToDo.Item();
                        ToDo.Item item2 = item1;
                        strs[str5] = item1;
                        item       = item2;
                    }
                    else
                    {
                        item = this.items[strArrays1[0]];
                    }
                    if (active && item.active == null)
                    {
                        item.active = new ToDo.SubItem();
                    }
                    ToDo.SubItem subItem = (active ? item.active : item.locked);
                    subItem.state    += int.Parse(strArrays1[1]);
                    subItem.priority += int.Parse(strArrays1[2]);
                    if (str4 != null)
                    {
                        str4 = str4.Replace("<br>", "\n");
                        if (subItem.description != null)
                        {
                            ToDo.SubItem subItem1 = subItem;
                            subItem1.description = string.Concat(subItem1.description, "\n", str4);
                        }
                        else
                        {
                            subItem.description = str4;
                        }
                    }
                    if ((int)strArrays1.Length > 3 && nums != null)
                    {
                        string[] strArrays2 = strArrays1[3].Split(new char[] { '.' });
                        int      num1       = int.Parse(strArrays2[0]);
                        if (num1 > subItem.assignedPrecidence)
                        {
                            subItem.assigned           = nums[int.Parse(strArrays2[1])];
                            subItem.assignedPrecidence = num1;
                        }
                    }
                }
                streamReader.Close();
                this.resolveItems();
            }
        }