示例#1
0
 public FormEditTaskEntity()
 {
     InitializeComponent();
     if (Program.p.AdminMode)
     {
         label2.Visible = false;
         label3.Visible = false;
     }
     ofd.Title = "Выберите изображение";
     ofd.Filter = "Файлы изображения|*.jpg; *jpeg; *bmp; *png;";
     label2.Text = Program.p.CurrentFullName;
     this.Size = Program.currentSize;
     this.Location = Program.currentLocation;
     this.FormClosing += Program.ApplicationQuit;
     pbTask.ImageLocation = currentTask._path + "mainpic.png";
     pbTask.BackgroundImageLayout = ImageLayout.Stretch;
     lDescription.Text = currentTask._description;
     lName.Text = currentTask._name;
     DirectoryInfo dir = new DirectoryInfo(@"content\phenomenas");
     try
     {
         foreach (var item in dir.GetFiles())
         {
             string tempName = item.Name;
             PhenomenaItem phitem = new PhenomenaItem();
             phitem.Location = new Point(0, counter);
             phitem.btnDelete.Visible = false;
             phitem.btnEdit.Visible = false;
             phitem.lPhenomena.CheckedChanged += lPhenomena_CheckedChanged;
             phitem.lPhenomena.Text = tempName.Remove(tempName.LastIndexOf(@"."));
             if (currentTask._phenomenas.IndexOf(phitem.lPhenomena.Text) > -1)
             {
                 phitem.lPhenomena.Checked = true;
             }
             if (tempName.IndexOf(@".rtf") > -1)
             {
                 counter += 40;
                 pnlPhenomenas.Controls.Add(phitem);
             }
         }
         if (pnlPhenomenas.Controls.Count==0)
         {
             pnlAddPhenomenas.Visible = true;
         }
     }
     catch (DirectoryNotFoundException)
     {
         Directory.CreateDirectory(@"content\phenomenas");
     }
     btnSaveChanges.Enabled = false;
     btnSaveChanges.BackColor = Color.FromArgb(226, 226, 226);
 }
示例#2
0
 public FormNewTask()
 {
     InitializeComponent();
     if (Program.p.AdminMode)
     {
         label2.Visible = false;
         label3.Visible = false;
     }
     this.FormClosing += Program.ApplicationQuit;
     //pnlWhite.Visible = false;
     label2.Text = Program.p.CurrentFullName;
     ofd.Title = "Выберите изображение";
     ofd.Filter = "Файлы изображения|*.jpg; *jpeg; *bmp; *png;";
     this.Size = Program.currentSize;
     this.Location = Program.currentLocation;
     DirectoryInfo dir = new DirectoryInfo(@"content\phenomenas");
     try
     {
         foreach (var item in dir.GetFiles())
         {
             string tempName = item.Name;
             PhenomenaItem phitem = new PhenomenaItem();
             phitem.Location = new Point(0, counter);
             phitem.btnDelete.Visible = false;
             phitem.btnEdit.Visible = false;
             phitem.lPhenomena.Text = tempName.Remove(tempName.LastIndexOf(@"."));
             phitem.lPhenomena.CheckedChanged += lPhenomena_CheckedChanged;
             if (tempName.IndexOf(@".rtf") > -1)
             {
                 counter += 40;
                 pnlPhenomenas.Controls.Add(phitem);
             }
         }
         if (pnlPhenomenas.Controls.Count == 0)
         {
             pnlAddPhenomenas.Visible = true;
         }
     }
     catch (DirectoryNotFoundException)
     {
         Directory.CreateDirectory(@"content\phenomenas");
     }
 }
示例#3
0
 private void UpdateList()
 {
     counter = 0;
     try
     {
         pnlPhenomenas.Controls.Clear();
         foreach (var item in dir.GetFiles())
         {
             string tempName = item.Name;
             PhenomenaItem phitem = new PhenomenaItem();
             phitem.Location = new Point(0, counter);
             phitem.Size = new System.Drawing.Size(250, phitem.Size.Height);
             phitem.lPhenomena.Visible = false;
             phitem.btnDelete.Click += btnDelete2_Click;
             phitem.btnEdit.Click+=btnEdit2_Click;
             phitem.lblPhenomena.Text = tempName.Remove(tempName.LastIndexOf(@"."));
             phitem.lblPhenomena.Visible = true;
             if (tempName.IndexOf(".rtf") > -1)
             {
                 counter += 40;
                 pnlPhenomenas.Controls.Add(phitem);
             }
         }
     }
     catch { }
 }