Esempio n. 1
0
        private void PictureBoxIconEditor_MouseDown(object sender, MouseEventArgs e)
        {
            if (comboBoxIconList.SelectedItem != null)
            {
                Icon selectedIcon = comboBoxIconList.SelectedItem as Icon;

                if (selectedIcon.IconPoints.Count(p => p.X == e.X / FieldSize &&
                                                  p.Y == e.Y / FieldSize) > 0)
                {
                    DC.IconPoints.DeleteAllOnSubmit(selectedIcon.IconPoints.Where(p => p.X == e.X / FieldSize &&
                                                                                  p.Y == e.Y / FieldSize));
                }
                else
                {
                    IconPoint ip = new IconPoint();
                    ip.X     = e.X / FieldSize;
                    ip.Y     = e.Y / FieldSize;
                    ip.Color = buttonColor.BackColor.ToArgb();
                    ip.Icon  = selectedIcon;
                    //połączenie z uwzględnieniem dwukierunkowej relacji - od drugiej strony relacji
                    //selectedIcon.IconPoints.Add(ip);
                }

                DC.SubmitChanges();
                LoadIconList(selectedIcon);
            }
        }
 partial void DeleteIconPoint(IconPoint instance);
 partial void UpdateIconPoint(IconPoint instance);
 partial void InsertIconPoint(IconPoint instance);
 private void detach_IconPoints(IconPoint entity)
 {
     this.SendPropertyChanging();
     entity.Icon = null;
 }
 private void attach_IconPoints(IconPoint entity)
 {
     this.SendPropertyChanging();
     entity.Icon = this;
 }