示例#1
0
        void prj_projectChanged(object sender, EventArgs e)
        {
            selprj = sender as PAllPrj;
            int count = prjviews.Count;
            int move  = selprj.idx;

            foreach (var item in prjviews)
            {
                item.isSelected = item == selprj;
                int tmp = item.idx - move;
                if (tmp < 0)
                {
                    tmp += count;
                }
                item.idx = tmp;
            }
            RaiseprojectChangedEvent();
        }
示例#2
0
        void buildview()
        {
            Color[] colors = new Color[] { Colors.Red, Colors.Cyan, Colors.Yellow, Colors.Lime, Colors.Blue, Colors.Purple };

            int idx = 0;

            foreach (var item in year.projects)
            {
                item.color = colors[idx % colors.Count()];
                PAllPrj prj = new PAllPrj()
                {
                    name = item.name, note = item.note, isSelected = idx == 0, idx = idx, color = item.color, Tag = item
                };
                if (idx == 0)
                {
                    selprj = prj;
                }
                prj.projectChanged += new EventHandler(prj_projectChanged);
                prjviews.Add(prj);

                grdMain.Children.Add(prj);
                idx++;
            }
        }