Beispiel #1
0
 private void mnuSelection_Click(object sender, RoutedEventArgs e)
 {
     if (sender == mnuSelectionCopy)
     {
         TheModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Copy);
     }
     else if (sender == mnuSelectionCopyE)
     {
         TheModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.CopyEnscoped);
     }
     else if (sender == mnuSelectionCut)
     {
         TheModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Cut);
     }
     else if (sender == mnuSelectionCutE)
     {
         TheModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.CutEnscoped);
     }
     else if (sender == mnuSelectionDelete)
     {
         TheModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Delete);
     }
     else if (sender == mnuSelectionCollect)
     {
         TheModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.Collect);
     }
     else if (sender == mnuSelectionCollectE)
     {
         TheModel.PerformCodeBlockOperation(PdfOverlayModel.CodeBlockAction.CollectEnscoped);
     }
 }
Beispiel #2
0
        private void canvas1_KeyDown(object sender, KeyEventArgs e)
        {
            // route event to current tool
            TEKeyArgs ee = e.ToTEKeyArgs();

            TheModel.CurrentTool.KeyDown(ee);
            e.Handled = ee.Handled;

            // turn off raster on Alt
            Rasterizer.View.OverrideWithZeroGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && !Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);
            Rasterizer.View.OverrideWithHalfGridWidth = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt) && Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);

            if (e.Key == Key.LeftAlt || e.Key == Key.RightAlt)
            {
                e.Handled = true;
            }

            if (!e.Handled)
            {
                // escape cancels current operation
                if (e.Key == Key.Escape)
                {
                    TheModel.ActivateDefaultTool();
                }
            }
        }
        public void GetBirthData_Test()
        {
            string firstName   = "Sloth";
            char   lastInitial = 'F';
            var    theData     = TheModel.GetBirthData(
                USERNAME,
                new Dictionary <string, object>
            {
                { "names", new Name[] { new Name {
                                            FirstName = firstName, LastInitial = lastInitial
                                        } } }
            }
                );

            Assert.That(theData.Any(), "Didn't get any birthdata, but should have.");

            foreach (BirthData birthData in theData)
            {
                string failMessage = string.Format("Was trying to retrieve birthday of someone named '{0}', but somehow got birthday of someone named '{1}'.", firstName, birthData.Name.FirstName);
                Assert.That(Regex.IsMatch(birthData.Name.FirstName, "^" + firstName + "$"), failMessage);

                failMessage = string.Format("Was trying to retrieve birthday of someone with last initial '{0}', but somehow got birthday of someone with last initial '{1}'.", lastInitial, birthData.Name.LastInitial);
                Assert.That(Regex.IsMatch(birthData.Name.LastInitial.ToString(), "^" + lastInitial.ToString() + "$"), failMessage);
            }
        }
        //
        // GET: /Home/
        public ActionResult Index()
        {
            var model = new TheModel();

            model.TheTest = "test";

            return View(model);
        }
Beispiel #5
0
        public void Delete(Name name)
        {
            var searchObject = new Dictionary <string, object> {
                { "names", new Name[] { name } }
            };

            TheModel.Delete(HttpContext.Current.User.Identity.Name, searchObject);
        }
Beispiel #6
0
        public IEnumerable <BirthData> GetForPeople(Name[] names)
        {
            var searchObject = new Dictionary <string, object> {
                { "names", names }
            };

            return(TheModel.GetBirthData(HttpContext.Current.User.Identity.Name, searchObject));
        }
Beispiel #7
0
        /**
         * @apiGroup Birthday
         * @api {Get} /Birthday/GetThisMonth Get birthdays for this month belonging to current user
         * @apiSuccess {object[]} return				The object returned by the API
         * @apiSuccess {object} return.name			Name Info
         * @apiSuccess {string} return.name.firstname	The person's first name
         * @apiSuccess {string} return.name.lastinitial	The person's last initial
         * @apiSuccess {string} return.birthday			The person's birthday
         * @apiSuccess {string} return.birthdayformat	The format of the birthday
         */
        public IEnumerable <BirthData> GetThisMonth()
        {
            var searchObject = new Dictionary <string, object> {
                { "month", DateTime.Now.Month }
            };

            return(TheModel.GetBirthData(HttpContext.Current.User.Identity.Name, searchObject));
        }
Beispiel #8
0
 private void InsertDependenciesClick(object sender, RoutedEventArgs e)
 {
     if (lstSnippets.SelectedItem != null)
     {
         SnippetsDataSet.SnippetsTableRow r = ((DataRowView)lstSnippets.SelectedItem).Row as SnippetsDataSet.SnippetsTableRow;
         TheModel.HandleInsertDependenciesClick(r);
     }
 }
Beispiel #9
0
 private void lstSnippets_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (lstSnippets.SelectedItem != null)
     {
         SnippetsDataSet.SnippetsTableRow r = ((DataRowView)lstSnippets.SelectedItem).Row as SnippetsDataSet.SnippetsTableRow;
         TheModel.HandleMouseDoubleClick(r);
     }
 }
 public ActionResult IndexC(TheModel sql_table)
 {
     //finds my first, by identity, row in sql_table wich has 
     //don't let the code advance past here
     //we can interrogate the sql_table variable and see 
     //that the formatted date is coming back
     var removeTime = sql_table.TableInModel.TheDate.ToShortDateString();
     return View();
 }
Beispiel #11
0
        private void UseStyleButton_Click(object sender, RoutedEventArgs e)
        {
            // find row corresponding to clicked button
            object curItem = ((ListBoxItem)lstSnippets.ContainerFromElement((Button)sender)).Content;

            if (curItem != null)
            {
                SnippetsDataSet.SnippetsTableRow r = (curItem as DataRowView).Row as SnippetsDataSet.SnippetsTableRow;
                TheModel.HandleUseStyleButtonClick(r);
            }
        }
Beispiel #12
0
        /* */
        /// <summary>
        /// Raises the Jumptosource event.
        /// Note that the object to be jumped to might not be at the current mouse position.
        /// (Namely, if the context menu was opened->mouse position changed to menu item-> clicked)
        /// It is stored in mnuJumpSource.Tag
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void JumpToSourceDoIt(object sender, RoutedEventArgs e)
        {
            if (sender != mnuJumpSource)
            {
                // jump to object at mouse position
                mnuJumpSource.Tag = ObjectAtCursor;
            }

            if (mnuJumpSource.Tag != null)
            {
                TheModel.JumpToSourceDoIt(mnuJumpSource.Tag as OverlayShapeVM);
            }
        }
        public List <TheModel> GetModel()
        {
            using (var context = DbContextCreator.Create())
            {
                List <Team> teams = context.Teams.ToList();

                var query = from x in context.Sales
                            where x.TeamId != null
                            group x by x.TeamId into g
                            select g;

                // 달성건수 추가
                List <TheModel> saleModels = new List <TheModel>();
                foreach (var g in query)
                {
                    TheModel model = new TheModel();
                    model.Type  = "달성건수";
                    model.Count = g.Count();
                    model.Team  = teams.Find(t => t.TeamId == g.Key.Value).Name;

                    saleModels.Add(model);
                }


                // 목표건수 추가
                List <TheModel> targetModels = new List <TheModel>();
                foreach (var saleModel in saleModels)
                {
                    Team team = teams.Find(t => t.Name == saleModel.Team);

                    if (team == null)
                    {
                        continue;
                    }

                    TheModel targetModel = new TheModel();
                    targetModel.Type  = "목표건수";
                    targetModel.Team  = team.Name;
                    targetModel.Count = team.Target ?? 0;

                    targetModels.Add(targetModel);
                }

                saleModels.AddRange(targetModels);

                return(saleModels);
            }
        }
 public ActionResult IndexC()
 {
     BreazEntities1 db = new BreazEntities1();
     var mod = new TheModel();
     mod.TableInModel = db.SQL_Table.Find(1);
     //the Key to this solution is that the type in sql
     //is Date instead of DateTime or the "{0:dd-MM-yyyy}"
     //If you insist on datetime then, even if you
     //format the time out of the date, if you bind it
     //back to a datetime field, the time will still be there
     //albeit 00:00:00
     //finds my first, by identity, row in sql_table wich has 
     //TheDate Column that are passing to view and back
     //out to controller          
     return View(mod);
 }
Beispiel #15
0
 private void mnuAssignStyle_Click(object sender, RoutedEventArgs e)
 {
     if (sender == mnuAssignCurrentNodeStyle)
     {
         TheModel.AssignStyle(PdfOverlayModel.AssignStyleType.AssignCurrentNodeStyle);
     }
     else if (sender == mnuAssignNewStyle)
     {
         TheModel.AssignStyle(PdfOverlayModel.AssignStyleType.AssignNewStyle);
     }
     else if (sender == mnuChangeToCurrentNodeStyle)
     {
         TheModel.AssignStyle(PdfOverlayModel.AssignStyleType.ChangeToCurrentNodeStyle);
     }
     else if (sender == mnuChangeToNewStyle)
     {
         TheModel.AssignStyle(PdfOverlayModel.AssignStyleType.ChangeToNewStyle);
     }
 }
Beispiel #16
0
        //SnippetsDataSet.SnippetsTableDataTable snippetsTable;
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //       snippetsDataSet = ((SnippetsDataSet)(this.FindResource("snippetsDataSet")));
            //       snippetsTable = snippetsDataSet.Tables["SnippetsTable"] as SnippetsDataSet.SnippetsTableDataTable;
            snippetsTableViewSource = (CollectionViewSource)this.FindResource("snippetsTableViewSource");
            // add source binding
            Binding b = new Binding("SnippetsTable")
            {
                Source = TheModel.snippetsDataSet
            };

            BindingOperations.SetBinding(snippetsTableViewSource, CollectionViewSource.SourceProperty, b);

            TheModel.Reload();

            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))  // we don't want this to happen in the vs designer
            {
                TheModel.CheckForThumbnails();
            }
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            TheModel m = new TheModel();

            Console.Write("Enter CPF: ");
            m.Cpf = Console.ReadLine();
            Console.Write("Enter CNPJ: ");
            m.Cnpj = Console.ReadLine();

            Console.WriteLine("Validating the model cpf: " + m.Cpf);
            Console.WriteLine("Validating the model cnpj: " + m.Cnpj);

            TheModelValidation val = new TheModelValidation();

            ValidationResult r = val.Validate(m);

            foreach (var item in r.Errors)
            {
                Console.WriteLine("CODE: " + item.ErrorCode + " - ERROR: " + item.ErrorMessage);
            }
        }
Beispiel #18
0
        protected override void OnRender(DrawingContext dc)
        {
            // Draw background
            dc.DrawRectangle(Brushes.White, null, new Rect(RenderSize));

            Transform t = new MatrixTransform(TheModel.GetTikzToScreenTransform().ToWpfMatrix());

            t.Freeze();

            Pen pen = new Pen(Brushes.WhiteSmoke, 1);

            pen.Freeze();

            TheModel.DrawRaster(
                (p1, p2) => dc.DrawLine(pen, t.Transform(p1), t.Transform(p2)),
                (r1, r2) =>
            {
                EllipseGeometry eg = new EllipseGeometry(new Point(0, 0), r1, r2);
                eg.Transform       = t;
                eg.Freeze();
                dc.DrawGeometry(null, pen, eg);
            });
        }
Beispiel #19
0
 void o_UseStyle(object sender, EventArgs e)
 {
     TheModel.HandleUseStyleButtonClick((sender as SnippetEntry).TheSnippet.Row);
 }
Beispiel #20
0
 /**
  * @apiGroup Birthday
  * @api {Post} /Birthday/Add Store a birthday for current user
  *
  * @apiParam {object} name				Name Info
  * @apiParam {string} name.firstname		The person's first name
  * @apiParam {string} name.lastinitial		The person's last initial
  * @apiParam {string} birthday			The person's birthday
  * @apiParam {string} birthdayformat		The optional format of the birthday (i.e. MM-DD)
  *
  * @apiSuccess {string} message			A description of what happened during the attempt to add the birthday
  */
 public object Add(BirthData birthData)
 {
     return(TheModel.Add(HttpContext.Current.User.Identity.Name, birthData));
 }
Beispiel #21
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new TheModel(SynchronizationContext.Current);
 }
Beispiel #22
0
 /**
  * @apiGroup Birthday
  * @api {Get} /Birthday Get all birthdays for current user
  * @apiSuccess {object[]} return				The object returned by the API
  * @apiSuccess {object} return.name			Name Info
  * @apiSuccess {string} return.name.firstname	The person's first name
  * @apiSuccess {string} return.name.lastinitial	The person's last initial
  * @apiSuccess {string} return.birthday			The person's birthday
  * @apiSuccess {string} return.birthdayformat	The format of the birthday
  */
 public IEnumerable <BirthData> Get()
 {
     return(TheModel.GetBirthData(HttpContext.Current.User.Identity.Name));
 }
Beispiel #23
0
 void o_InsertAsStyle(object sender, EventArgs e)
 {
     TheModel.HandleInsertAsTikzStyleClick((sender as SnippetEntry).TheSnippet.Row);
 }
Beispiel #24
0
        private void CreateContextMenu()
        {
            var m = TheContextMenu = new ContextMenu();
            var i = new MenuItem("Insert Snippet");

            i.Click += (s, e) => { if (PopupSource != null)
                                   {
                                       TheModel.HandleInsertSnippetClick(PopupSource.TheSnippet.Row);
                                   }
            };
            m.MenuItems.Add(i);
            i        = new MenuItem("Insert full Code Sample");
            i.Click += (s, e) => { if (PopupSource != null)
                                   {
                                       TheModel.HandleInsertFullCodeClick(PopupSource.TheSnippet.Row);
                                   }
            };
            m.MenuItems.Add(i);
            i        = new MenuItem("Insert Dependencies");
            i.Click += (s, e) => { if (PopupSource != null)
                                   {
                                       TheModel.HandleInsertDependenciesClick(PopupSource.TheSnippet.Row);
                                   }
            };
            m.MenuItems.Add(i);
            m.MenuItems.Add(new MenuItem("-"));

            var mm   = new MenuItem("Thumbnails");
            var ioff = new MenuItem("Off")
            {
                RadioCheck = true
            };

            ioff.Click += (s, e) => { ThumbnailSize = 0; };
            mm.MenuItems.Add(ioff);
            var ismall = new MenuItem("Small")
            {
                RadioCheck = true
            };

            ismall.Click += (s, e) => { ThumbnailSize = 40; };
            mm.MenuItems.Add(ismall);
            var imiddle = new MenuItem("Medium")
            {
                RadioCheck = true
            };

            imiddle.Click += (s, e) => { ThumbnailSize = 70; };
            mm.MenuItems.Add(imiddle);
            var ilarge = new MenuItem("Large")
            {
                RadioCheck = true
            };

            ilarge.Click += (s, e) => { ThumbnailSize = 150; };
            mm.MenuItems.Add(ilarge);
            m.MenuItems.Add(mm);
            m.Popup += (s, e) =>
            {
                PopupSource     = TheContextMenu.SourceControl as SnippetEntry;
                ioff.Checked    = ThumbnailSize == 0;
                ismall.Checked  = ThumbnailSize == 40;
                imiddle.Checked = ThumbnailSize == 70;
                ilarge.Checked  = ThumbnailSize == 150;
            };
        }
Beispiel #25
0
 void o_MouseDoubleClick(object sender, EventArgs e)
 {
     TheModel.HandleMouseDoubleClick((sender as SnippetEntry).TheSnippet.Row);
 }