public RecordPresenter(IRecordView view)
        {
            if (view == null)
            {
                throw new Exception("view cannot be null");
            }

            box = new BoxEntry(view);
        }
Exemple #2
0
        void AddBox(float Timestamp, Vector2 Position)
        {
            BoxEntry NewEntry = new BoxEntry()
            {
                Timestamp = Timestamp,
                Position  = Position
            };

            ModeClass.PaintBox(ref NewEntry);
            Boxes.Add(NewEntry);
        }
        public BoxDetailsPresenter(IView view, SqlDataAccess dataAccess)
        {
            if (view == null)
            {
                throw new Exception("view cannot be null");
            }

            this.view       = view;
            this.dataAccess = dataAccess;
            box             = new BoxEntry(view);
        }
        public BoxDetailsPresenter(IView view)
        {
            if (view == null)
            {
                throw new Exception("view cannot be null");
            }

            this.view  = view;
            dataAccess = new SqlDataAccess(ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString);
            box        = new BoxEntry(view);
        }
Exemple #5
0
        public bool RemoveBox(string input)
        {
            BoxEntry entry = _context.BoxEntries.FirstOrDefault(x => x.User.Id == _user.Id && x.Text == input);

            if (entry != null)
            {
                _context.BoxEntries.Remove(entry);
                _context.SaveChanges();
                return(true);
            }
            return(false);
        }
Exemple #6
0
 public override void PaintBox(ref BoxEntry Box)
 {
     if (Mathf.Abs(Box.Position.x * Box.Position.y) < .35f)
     {
         float Hue = Box.Timestamp % 1;
         Box.Tint = Color.HSVToRGB(Hue, 1, 1);
         Box.Edge = Color.HSVToRGB(Hue, 1, .5f);
     }
     else
     {
         Box.Tint = new Color(.5f, .5f, .5f, 1);
         Box.Edge = new Color(.25f, .25f, .25f, 1);
     }
 }
Exemple #7
0
 public void Run(IrcMessage theMessage)
 {
     using (var context = new BotContext())
     {
         BoxManager manager = new BoxManager(context.GetUser(theMessage.Nickname), context);
         if (manager.HasBox(theMessage.CommandLine))
         {
             theMessage.Answer($"Wups, danke aber du hast mir deine \"{theMessage.CommandLine}\" bereits mitgeteilt ;-).");
             return;
         }
         BoxEntry box = manager.AddBox(theMessage.CommandLine);
         theMessage.Answer($"Okay danke, ich werde mir deine \"{box.Text}\"{(box.Box != null ? " (" + box.Box.FullName + ")" : "")} notieren.");
     }
 }
Exemple #8
0
        public BoxEntry AddBox(string input)
        {
            BoxEntry entry = new BoxEntry();

            entry.User = _user;
            entry.Text = input;

            if (BoxDatabase.TryFindExactBox(input, out Box? result))
            {
                entry.Box = result;
                _context.Boxes.Attach(result);
            }

            _context.BoxEntries.Add(entry);
            _context.SaveChanges();
            return(entry);
        }
Exemple #9
0
 public override void PaintBox(ref BoxEntry Box)
 {
     Box.Tint = Box.Position.x < .5f ? new Color(0, .5f, 1, 1) : new Color(1, .5f, 0, 1);
     Box.Edge = Box.Position.x < .5f ? new Color(0, 0, .5f, 1) : new Color(.5f, 0, 0, 1);
 }
Exemple #10
0
 public abstract void PaintBox(ref BoxEntry Box);