Example #1
0
 public ChildViewModel(Child child)
 {
     Birthday = child.Birthday;
     FullName = child.FullName;
     Id = child.Id;
     Addres = child.Addres;
 }
 public void SetUp()
 {
     this._parent = new Parent();
     this._child = new Child();
     this._parent.Child = this._child;
     this._child.Parent = this._parent;
 }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Service1Client service = new WCFWebReference.Service1Client();

            string userName = UserNameTB.Text;
            string password = service.GetHashedPassword(UserPasswordTB.Text);
            Person obj = service.Login(userName, password);

            if (obj != null)
            {
                if (obj.GetType() == typeof(Child))
                {
                    child = (Child)obj;
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Teachers cannot log in using this platform. /nPlease use the windows software')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('No user found')</script>");
            }
        }
Example #4
0
 public Parent(Child[] children)
 {
     foreach (var child in children)
     {
         child.Events.AddListenerStream(_childEvents);
     }
 }
		public int TestAccessToProtected (Child c)
		{
			if (c.a == 0)
				return 1;
			else
				return 2;
		}
Example #6
0
 public void TypeEqualityIsRespected()
 {
     var parent = new Parent().GetChangeType();
     var child = new Child().GetChangeType();
     Assert.IsTrue(parent.IsA(typeof(Parent)));
     Assert.IsTrue(child.IsA(typeof(Child)));
 }
Example #7
0
        private void UpdateCoverArt(Task<IImageFormat<Image>> task, Child child)
        {
            switch (task.Status)
            {
                case TaskStatus.RanToCompletion:
                    if (task.Result == null)
                        return;

                    using (_currentAlbumArt = task.Result.Image)
                    {
                        if (_currentAlbumArt != null)
                        {
                            string localFileName = GetCoverArtFilename(child);

                            try
                            {
                                _currentAlbumArt.Save(localFileName);

                                Dispatcher.Invoke(() => MusicCoverArt.Source = _currentAlbumArt.ToBitmapSource().Resize(BitmapScalingMode.HighQuality, true, (int)(MusicCoverArt.Width * ScalingFactor), (int)(MusicCoverArt.Height * ScalingFactor)));
                            }
                            catch(Exception)
                            {
                            }
                        }
                    }

                    task.Result.Dispose();

                    break;
            }
        }
        public CommunityMember convertMainObjectToCommunityMember(MainObjectFromCsvFileInfo mainObject)
        {
            CommunityMember communityMemberVm = new CommunityMember();

            if(string.IsNullOrWhiteSpace(mainObject.FatherFirstName) && string.IsNullOrWhiteSpace(mainObject.FatherLastName)) {
                communityMemberVm.FirstName = string.IsNullOrWhiteSpace(mainObject.MotherFirstName) ? "N/A" : mainObject.MotherFirstName;
                communityMemberVm.LastName = string.IsNullOrWhiteSpace(mainObject.MotherLastName) ? "N/A" : mainObject.MotherLastName;
            } else {
                communityMemberVm.FirstName = string.IsNullOrWhiteSpace(mainObject.FatherFirstName)? "N/A" : mainObject.FatherFirstName;
                communityMemberVm.LastName = string.IsNullOrWhiteSpace(mainObject.FatherLastName)? "N/A" : mainObject.FatherLastName;
                communityMemberVm.SpouseFirstName = string.IsNullOrWhiteSpace(mainObject.MotherFirstName)? "N/A" : mainObject.MotherFirstName;
                communityMemberVm.SpouseLastName = string.IsNullOrWhiteSpace(mainObject.MotherLastName)? "N/A" : mainObject.MotherLastName;
            }
            communityMemberVm.PhoneNumber = mainObject.FatherPhone;
            communityMemberVm.SpousePhoneNumber = mainObject.MotherPhone;
            communityMemberVm.Email = "*****@*****.**";

            if (mainObject.Children != null && mainObject.Children.Count() > 0)
            {
                communityMemberVm.Children = new List<Child>();
                for (int i = 0; i < mainObject.Children.Count(); i++)
                {
                    var mainObjectChild = mainObject.Children[i];
                    Child child = new Child();
                    child.FirstName = mainObjectChild.ChildFirstName;
                    child.LastName = string.IsNullOrWhiteSpace(communityMemberVm.LastName) ? "" : communityMemberVm.LastName;
                    child.Gender = mainObjectChild.Gender;
                    child.DateOfBirth = new Extentions().getDobFromAge(mainObjectChild.Age);
                    communityMemberVm.Children.Add(child);

                }
            }

            return communityMemberVm;
        }
Example #9
0
        static void Main(string[] args)
        {
            Child child = new Child();

            // Previously null checks were needed before accessing a parent property.
            string grandParentNameOld = "No name found";

            if (child.Parent != null)
                if (child.Parent.GrandParent != null)
                    grandParentNameOld = child.Parent.GrandParent.Name;

            // C# 6: If any property is null, a null result is returned immediately.
            // Can be conveniently used with the null-coalescing operator.
            string grandParentNameNew = child.Parent?.GrandParent?.Name ?? "No name found";

            Console.WriteLine(grandParentNameOld);
            Console.WriteLine(grandParentNameNew);

            // C# 6: Also works with indexers.
            int[] arr = null;
            int foundOld = arr != null ? arr[1337] : 0;
            int foundNew = arr?[1337] ?? 0;

            // Can't use Null-conditional operator to call a delegate directly.
            // But can be used by calling the Invoke method.
            Func<string, string> func = null;
            string result = func?.Invoke("Not invoked");
            //string result = func?(); // Syntax not supported

            // The Null-conditional operator is nice to use when raising events.
            // The call is thread-safe, since the reference is held in a temporary variable.
            PropertyChanged?.Invoke(null, null);

            Console.Read();
        }
Example #10
0
 public void InheritanceIsRespected()
 {
     var parent = new Parent().GetChangeType();
     var child = new Child().GetChangeType();
     Assert.IsFalse(parent.IsA(typeof(Child)));
     Assert.IsTrue(child.IsA(typeof(Parent)));
 }
Example #11
0
        public void Test()
        {
            Family family = new Family();
            Child child1 = new Child(1);
            Child child2 = new Child(2);
            Parent parent = new Parent(new List<Child>() {child1, child2});
            family.Add(parent);

            string file = "sandbox.txt";

            try
            {
                File.Delete(file);
            }
            catch
            {
            }

            using (var fs = File.OpenWrite(file))
            {
                Serializer.Serialize(fs, family);
            }
            using (var fs = File.OpenRead(file))
            {
                family = Serializer.Deserialize<Family>(fs);
            }

            System.Diagnostics.Debug.Assert(family != null, "1. Expect family not null, but not the case.");
        }
Example #12
0
    public static void Main()
    {
        Child child = new Child();

        child.print();

        ((Parent)child).print();
    }
        public void PropertyAccessorAccessibilityTest()
        {
            Parent parent = new Parent();
            Assert.AreEqual("parent", parent.Name);

            Child child = new Child();
            Assert.AreEqual("child", child.Name);
        }
        public void SetUp()
        {
            parent = new Parent("Mike Hadlow", "*****@*****.**", "pwd");
            child = parent.CreateChild("Leo", "leohadlow", "xxx");

            somebodyElse = new Parent("John Robinson", "*****@*****.**", "pwd");
            somebodyElsesChild = somebodyElse.CreateChild("Jim", "jimrobinson", "yyy");
        }
 public ActionResult AddChild(Child child)
 {
     if (ModelState.IsValid)
     {
         return Json(membersRepo.AddChild(child), JsonRequestBehavior.AllowGet);
     }
     return Json(ErrorMessages.getErrorFieldsEmptyServerResponse(), JsonRequestBehavior.AllowGet);
 }
 public static void Main(string[] args)
 {
     System.Console.WriteLine("Child c1 = new Child();");
     Child c1 = new Child();
     System.Console.WriteLine("\n\n");
     // Notice that static constructors are only run ONCE per class.
     System.Console.WriteLine("Child c2 = new Child(5)");
     Child c2 = new Child(5);
 }
Example #17
0
 public void AddNewAndCheckParent()
 {
     var cl = new TstClient();
     var pr = cl.GetRoot<Root>().ParentItems.First();
     var child = new Child {Value = 99.9};
     pr.Children.Add(child);
     Assert.AreEqual(true, pr.Children.Contains(child));
     Assert.AreEqual(pr, child.Parent);
 }
Example #18
0
 public void LostChild(Child lost)
 {
     thePlayer.SendMessage("AddScore", -100.0f);
     thePlayer.SendMessage("LoseLife");
     Player p = thePlayer.gameObject.GetComponent<Player>();
     p.children.Remove(lost);
     ChangePhase(mourning);
     messageGUI.DisplayMessage("You lost your child! Be more careful.");
 }
Example #19
0
 public void Undo()
 {
     var cl = new TstClient();
     var pr = cl.GetRoot<Root>().ParentItems.First();
     var clientSideChild = new Child {Value = 3.0};
     pr.Children.Add(clientSideChild);
     cl.Undo(pr.Uid);
     Assert.AreEqual(2, pr.Children.Count);
 }
        public void SetUp()
        {
            mediator = new Mock<IMediator>();

            parent = new Parent("Dad", "*****@*****.**", "xxx");
            child = parent.CreateChild("Leo", "leohadlow", "yyy");
            parent.MakePaymentTo(child, 10.00M);

            somebodyElsesParent = new Parent("Not Dad", "*****@*****.**", "zzz");
        }
        public void ShouldSetProperty()
        {
            var child = new Child();
            ReflectionUtil.SetProperty(child, "Text", "foo");
            child.Text.ShouldBe("foo");

            var parent = new Parent();
            ReflectionUtil.SetProperty(parent, new[] { "Child", "Text" }, "bar");
            parent.Child.Text.ShouldBe("bar");
        }
	void Start () 
	{
		left = Screen.width / 9;
		top = Screen.height / 9;
		width = 400f;
		height = 400f;
		asl = GameObject.Find("ASL").GetComponent<ASL>();
		anotherPlayer = GameObject.Find("AnotherPlayer").GetComponent<AnotherPlayer>();
		child = GameObject.Find("Child").GetComponent<Child>();
	}
Example #23
0
 public void Add()
 {
     var cl = new TstClient();
     var pr = cl.GetRoot<Root>().ParentItems.First();
     var cnt = pr.Children.Count;
     var child = new Child {Value = 3.0};
     pr.Children.Add(child);
     Assert.AreEqual(cnt + 1, pr.Children.Count);
     Assert.AreEqual(pr, child.Parent);
 }
Example #24
0
    void Awake()
    {
        InputManager.Instance.PushActiveContext("Awake", (int)PlayerNumber);
        InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerAxis);
        InputManager.Instance.AddCallback((int)PlayerNumber, HandlePlayerButtons);

        _child = GetComponent<Child>();
        _autoTarget = GetComponent<AutoTarget>();
        _child.Index = (int)PlayerNumber;
    }
        public void OriginalValidatorThrowsException()
        {
            var instance = new Child
            {
                Name = null
            };

            var context = new ValidationContext(instance, null, null);

            Assert.Throws<ValidationException>(() => Validator.ValidateObject(instance, context, true));
        }
        public void SetUp()
        {
            this._context = new InMemoryDataContext();

            this._parent = new Parent();
            this._child = new Child();
            this._parent.Child = this._child;
            this._child.Parent = this._parent;

            this._context.Add(_parent);
            this._context.Commit();
        }
Example #27
0
 public void Redo()
 {
     var cl = new TstClient();
     var pr = cl.GetRoot<Root>().ParentItems.First();
     var child = new Child {Value = 3.0};
     var cnt = pr.Children.Count;
     pr.Children.Add(child);
     cl.Undo(pr.Uid);
     Assert.AreEqual(cnt, pr.Children.Count);
     cl.Redo(pr.Uid);
     Assert.AreEqual(true, pr.Children.SingleOrDefault(_child => _child.Uid == child.Uid) != null);
 }
        public void CanSaveAndGetChildrenWithFixtures()
        {
            const string childName = "Lawrence McGee";
            const string anotherName = "Richard Henderson";

            var myChild = new Child
            {
                Name = childName
            };

            var initialFixtureList = new List<Fixture>
            {
                new Fixture
                {
                    Sport = "Rugby Union",
                    Team = "U8",
                    School = "Tockington",
                    Kickoff = new DateTime(2016, 1, 1, 12, 00, 00),
                    Players = {childName}
                }
            };

            var myChildWithInitialFixture = myChild.UpdateFixtureList(initialFixtureList);

            var updatedFixtureList = new List<Fixture>
            {
                new Fixture
                {
                    Sport = "Rugby Union",
                    Team = "U8",
                    School = "Tockington",
                    Kickoff = new DateTime(2016, 1, 1, 12, 00, 00),
                    Players = {anotherName}
                }
            };

            var myChildWithUpdatedFixture = myChildWithInitialFixture.UpdateFixtureList(updatedFixtureList);

            const string backingStore = "test";
            var persister = new BackingStore(backingStore);

            persister.SaveAll(new List<Child> {myChildWithUpdatedFixture});

            var childList = persister.GetAll().ToList();

            Assert.That(childList.Count, Is.EqualTo(1));
            var myRestoredChild = childList[0];

            Assert.That(myRestoredChild.ParentShouldBeInformed(), Is.True);
            Assert.That(
                myRestoredChild.GetMessageForParent()
                    .Contains("Now NOT playing in U8 Rugby Union at Tockington on 01 January 2016 12:00"));
        }
Example #29
0
 Child readChild(DataReader reader)
 {
     int t = reader.ReadInt32();
     if (t == 0)
     {
         return null;
     }
     Child child = new Child();
     child.TextureOffset = t;
     child.VifOffset = reader.ReadInt32();
     child.VifLength = reader.ReadInt32();
     return child;
 }
        public void SetUp()
        {
            parent = new Parent("Dad", "*****@*****.**", "xxx");
            child = parent.CreateChild("Leo", "leohadlow", "yyy");
            parent.MakePaymentTo(child, 10.00M);

            somebodyElsesParent = new Parent("Not Dad", "*****@*****.**", "zzz");

            // make sure these tests pass on non en-GB machines
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");

            //DomainEvent.TurnOff();
        }
Example #31
0
 protected virtual void DrawInner(RenderDrawContext renderContext)
 {
     Child?.Draw(renderContext);
 }
Example #32
0
 public void LoadData(string mapPath, CompilerContext context)
 {
     LoadTileData(context);
     Child.LoadTilesets(mapPath, context);
 }
Example #33
0
 public void AddChild(Child child)
 {
     Children.Add(child);
     child.Parent = this;
 }
        //---------------------------------------------------------------------------------------
        // Opens the current operator. This involves opening the child operator tree, enumerating
        // the results, sorting them, and then returning an enumerator that walks the result.
        //

        internal override QueryResults <TInputOutput> Open(QuerySettings settings, bool preferStriping)
        {
            QueryResults <TInputOutput> childQueryResults = Child.Open(settings, false);

            return(new SortQueryOperatorResults <TInputOutput, TSortKey>(childQueryResults, this, settings, preferStriping));
        }
        //---------------------------------------------------------------------------------------
        // Returns an enumerable that represents the query executing sequentially.
        //

        internal override IEnumerable <TInputOutput> AsSequentialQuery(CancellationToken token)
        {
            IEnumerable <TInputOutput> wrappedChild = CancellableEnumerable.Wrap(Child.AsSequentialQuery(token), token);

            return(wrappedChild.OrderBy(_keySelector, _comparer));
        }
Example #36
0
 public void Any7([DataContexts] string context)
 {
     using (var db = GetDataContext(context))
         Assert.AreEqual(Child.Any(), db.Child.Any());
 }
Example #37
0
        static void actions()
        {
            Console.WriteLine("Ingrese el miembro de familia Hijo = h, Padre = p , Madre = m");
            string member = Console.ReadLine();

            Console.WriteLine("Ingrese el nombre:");
            string n = Console.ReadLine();

            Console.WriteLine("Ingrese el apellido:");
            string ln = Console.ReadLine();


            Console.WriteLine("Seleccione la accion a ejecutar:");
            Console.WriteLine("1 dormir");
            Console.WriteLine("2 despertar");
            Console.WriteLine("3 desayunar");
            Console.WriteLine("4 almorzar");
            Console.WriteLine("5 cenar");
            Console.WriteLine("Ingrse el numero");
            int action = int.Parse(Console.ReadLine());

            Console.WriteLine("Ingrese la hora ejm 9:00 PM/AM");
            string hour = Console.ReadLine();

            switch (member)
            {
            case "p":
                Father father = new Father(n, ln);
                Console.WriteLine("Es el padre de la casa:");
                Console.WriteLine("Nombre: " + father.name);
                Console.WriteLine("Apellido: " + father.last_name);
                switch (action)
                {
                case 1:
                    Console.WriteLine(father.sleep(hour));
                    break;

                case 2:
                    Console.WriteLine(father.wake(hour));
                    break;

                case 3:
                    Console.WriteLine(father.have_breakfast(hour));
                    break;

                case 4:
                    Console.WriteLine(father.to_have_lunch(hour));
                    break;

                case 5:
                    Console.WriteLine(father.dine(hour));
                    break;

                default:
                    Console.WriteLine("No hay lectura");
                    break;
                }
                Console.WriteLine("¿En que trabaja?");
                Console.WriteLine(father.work());
                break;

            case "m":
                Mother mother = new Mother(n, ln);
                Console.WriteLine("Es la Madre de la casa:");
                Console.WriteLine("Nombre: " + mother.name);
                Console.WriteLine("Apellido: " + mother.last_name);
                switch (action)
                {
                case 1:
                    Console.WriteLine(mother.sleep(hour));
                    break;

                case 2:
                    Console.WriteLine(mother.wake(hour));
                    break;

                case 3:
                    Console.WriteLine(mother.have_breakfast(hour));
                    break;

                case 4:
                    Console.WriteLine(mother.to_have_lunch(hour));
                    break;

                case 5:
                    Console.WriteLine(mother.dine(hour));
                    break;

                default:
                    Console.WriteLine("No hay lectura");
                    break;
                }
                Console.WriteLine("¿En que trabaja?");
                Console.WriteLine(mother.work());
                break;

            default:
                Child child = new Child(n, ln);
                Console.WriteLine("Es un hijo de la familia:");
                Console.WriteLine("Nombre: " + child.name);
                Console.WriteLine("Apellido: " + child.last_name);
                switch (action)
                {
                case 1:
                    Console.WriteLine(child.sleep(hour));
                    break;

                case 2:
                    Console.WriteLine(child.wake(hour));
                    break;

                case 3:
                    Console.WriteLine(child.have_breakfast(hour));
                    break;

                case 4:
                    Console.WriteLine(child.to_have_lunch(hour));
                    break;

                case 5:
                    Console.WriteLine(child.dine(hour));
                    break;

                default:
                    Console.WriteLine("No hay lectura");
                    break;
                }
                Console.WriteLine("¿En que trabaja?");
                Console.WriteLine(child.work());
                break;
            }
        }
        //---------------------------------------------------------------------------------------
        // Returns an enumerable that represents the query executing sequentially.
        //

        internal override IEnumerable <TOutput> AsSequentialQuery(CancellationToken token)
        {
            return(Child.AsSequentialQuery(token).Select(m_selector));
        }
Example #39
0
 public Parent(int Age, string EyeColor, Child MyChild)
 {
     this.Age      = Age;
     this.EyeColor = EyeColor;
     this.MyChild  = MyChild;
 }
Example #40
0
        public static void test_grand_children_finalize()
        {
            Child obj = new Child();

            Test.AssertEquals(42, obj.receivedValue);
        }
Example #41
0
        public override Expression CreateExpression(object context)
        {
            var res = Child.CreateExpression(context);

            return(res);
        }
    public Child GetChild()
    {
        Child child = childMapper.MapFromSource(childDo);

        return(child);
    }
Example #43
0
 public void updateChildDetails(Child child)
 {
     dl.updateChildDetails(child);
 }
        //---------------------------------------------------------------------------------------
        // Just opens the current operator, including opening the left child and wrapping with a
        // partition if needed. The right child is not opened yet -- this is always done on demand
        // as the outer elements are enumerated.
        //

        internal override QueryResults <TOutput> Open(QuerySettings settings, bool preferStriping)
        {
            QueryResults <TLeftInput> childQueryResults = Child.Open(settings, preferStriping);

            return(new UnaryQueryOperatorResults(childQueryResults, this, settings, preferStriping));
        }
Example #45
0
 static IQueryable <Parent> GetParent(ITestDataContext db, Child ch)
 {
     throw new InvalidOperationException();
 }
Example #46
0
 public void Sum1()
 {
     ForEachProvider(db => Assert.AreEqual(
                         Child.Sum(c => c.ParentID),
                         db.Child.Sum(c => c.ParentID)));
 }
Example #47
0
        //---------------------------------------------------------------------------------------
        // Returns an enumerable that represents the query executing sequentially.
        //

        internal override IEnumerable <TInputOutput> AsSequentialQuery(CancellationToken token)
        {
            IEnumerable <TInputOutput> wrappedChild = CancellableEnumerable.Wrap(Child.AsSequentialQuery(token), token);

            return(wrappedChild.Where(_predicate));
        }
 public void AddInCollection(Child child)
 {
     this.children.Enqueue(child);
 }
Example #49
0
 public void RemoveChild(Child child)
 {
     Children.Remove(child);
     child.Parent = null;
 }
Example #50
0
        protected virtual void CollectInner(RenderContext renderContext)
        {
            RenderView.CullingMask = RenderMask;

            Child?.Collect(renderContext);
        }
Example #51
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            tree     = new TreeView();
            var sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            image = new Xwt.ImageView();
            //	headerBox.PackStart (image, false, false, 0);

            labelTitle        = new Label();
            labelTitle.Xalign = 0;
            textHeader        = new Alignment(0, 0, 1, 1);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            headerBox.PackStart(imageHeader.ToGtkWidget());

            var fboxHeader = new HeaderBox();

            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            var fbox = new HeaderBox();

            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
Example #52
0
        //---------------------------------------------------------------------------------------
        // Just opens the current operator, including opening the child and wrapping it with
        // partitions as needed.
        //

        internal override QueryResults <TOutput> Open(QuerySettings settings, bool preferStriping)
        {
            QueryResults <TInput> childQueryResults = Child.Open(settings, preferStriping);

            return(SelectQueryOperatorResults.NewResults(childQueryResults, this, settings, preferStriping));
        }
Example #53
0
    static void Main(string[] args)
    {
        var command = Console.ReadLine();
        var people  = new List <Person>();

        while (command != "End")
        {
            var    info = command.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string name = info[0];

            var newPerson = people.Where(x => x.Name == name).FirstOrDefault();

            if (newPerson == null)
            {
                newPerson = new Person()
                {
                    Name     = name,
                    Parents  = new List <Parent>(),
                    Pokemons = new List <Pokemon>(),
                    Children = new List <Child>()
                };
            }

            string type = info[1];
            switch (type)
            {
            case "company":
                string  companyName = info[2];
                string  department  = info[3];
                decimal salary      = decimal.Parse(info[4]);

                var newComp = new Company()
                {
                    CompanyName = companyName,
                    Department  = department,
                    Salary      = salary
                };
                newPerson.Company = newComp;
                break;

            case "pokemon":
                string pokemonName = info[2];
                string pokemonType = info[3];
                var    newPokemon  = new Pokemon()
                {
                    PokemonName = pokemonName,
                    PokemonType = pokemonType
                };
                newPerson.Pokemons.Add(newPokemon);
                break;

            case "parents":
                string parentName     = info[2];
                string parentBirthday = info[3];
                var    newParent      = new Parent()
                {
                    ParentName     = parentName,
                    ParentBirthday = parentBirthday
                };
                newPerson.Parents.Add(newParent);
                break;

            case "children":
                string childName     = info[2];
                string childBirthday = info[3];
                var    newChild      = new Child()
                {
                    ChildName     = childName,
                    ChildBirthday = childBirthday
                };
                newPerson.Children.Add(newChild);
                break;

            case "car":
                string carModel = info[2];
                string carSpeed = info[3];
                var    newCar   = new Car()
                {
                    CarModel = carModel,
                    CarSpeed = carSpeed
                };
                newPerson.Car = newCar;
                break;
            }
            people.Add(newPerson);
            command = Console.ReadLine();
        }
        var name_  = Console.ReadLine();
        var person = people.Where(x => x.Name == name_).FirstOrDefault();

        Console.WriteLine($"{name_}");
        Console.WriteLine("Company:");
        if (person.Company != null)
        {
            Console.WriteLine($"{person.Company.CompanyName} {person.Company.Department} {person.Company.Salary:f2}");
        }

        Console.WriteLine("Car:");
        if (person.Car != null)
        {
            Console.WriteLine($"{person.Car.CarModel} {person.Car.CarSpeed}");
        }

        Console.WriteLine("Pokemon:");
        if (person.Pokemons.Count != 0)
        {
            foreach (var pokemon in person.Pokemons)
            {
                Console.WriteLine($"{pokemon.PokemonName} {pokemon.PokemonType}");
            }
            ;
        }
        Console.WriteLine("Parents:");
        if (person.Parents != null)
        {
            foreach (var parent in person.Parents)
            {
                Console.WriteLine($"{parent.ParentName} {parent.ParentBirthday}");
            }
            ;
        }
        Console.WriteLine("Children:");
        if (person.Children != null)
        {
            foreach (var child in person.Children)
            {
                Console.WriteLine($"{child.ChildName} {child.ChildBirthday}");
            }
            ;
        }
    }
 public void SetUp()
 {
     child = new Parent("Mike", "*****@*****.**", "xxx").CreateChild("Leo", "leo2", "yyy");
 }
Example #55
0
 public override string DebugDescription()
 {
     return(string.Format("{0} -> {1}", OwnCharacter, Child != null ? Child.DebugDescription() : "null"));
 }
Example #56
0
 public void addChild(Child child)
 {
     dl.addChild(child);//clone????
 }
Example #57
0
 public void Count1()
 {
     ForEachProvider(db => Assert.AreEqual(
                         Child.Count(c => c.ParentID == 1),
                         db.Child.Count(c => c.ParentID == 1)));
 }
Example #58
0
        //---------------------------------------------------------------------------------------
        // Returns an enumerable that represents the query executing sequentially.
        //

        internal override IEnumerable <TResult> AsSequentialQuery(CancellationToken token)
        {
            if (_take)
            {
                if (_indexedPredicate != null)
                {
                    return(Child.AsSequentialQuery(token).TakeWhile(_indexedPredicate));
                }

                Debug.Assert(_predicate != null);
                return(Child.AsSequentialQuery(token).TakeWhile(_predicate));
            }

            if (_indexedPredicate != null)
            {
                IEnumerable <TResult> wrappedIndexedChild = CancellableEnumerable.Wrap(Child.AsSequentialQuery(token), token);
                return(wrappedIndexedChild.SkipWhile(_indexedPredicate));
            }

            Debug.Assert(_predicate != null);
            IEnumerable <TResult> wrappedChild = CancellableEnumerable.Wrap(Child.AsSequentialQuery(token), token);

            return(wrappedChild.SkipWhile(_predicate));
        }
Example #59
0
        internal void BuildElementString(StringBuilder builder)
        {
            if (Combinator.HasValue)
            {
                switch (Combinator.Value)
                {
                case Model.Combinator.PrecededImmediatelyBy:
                    builder.Append("+ ");
                    break;

                case Model.Combinator.ChildOf:
                    builder.Append("> ");
                    break;

                case Model.Combinator.PrecededBy:
                    builder.Append("~ ");
                    break;

                    //case Model.Combinator.Namespace:
                    //    builder.Append("|");
                    //    break;
                }
            }

            if (ElementName != null)
            {
                builder.Append(ElementName);
            }

            if (ID != null)
            {
                builder.AppendFormat("#{0}", ID);
            }

            if (Class != null)
            {
                builder.AppendFormat(".{0}", Class);
            }

            if (Pseudo != null)
            {
                builder.AppendFormat(":{0}", Pseudo);
            }

            if (Attribute != null)
            {
                //builder.Append(Attribute.ToString());
                Attribute.BuildElementString(builder);
            }

            if (Function != null)
            {
                //builder.Append(Function.ToString());
                Function.BuildElementString(builder);
            }

            if (Child != null)
            {
                if (Child.ElementName != null)
                {
                    builder.Append(" ");
                }

                //builder.Append(Child.ToString());
                Child.BuildElementString(builder);
            }

            //return builder.ToString();
        }
Example #60
0
        FindInFilesDialog(bool showReplace)
        {
            Build();
            IdeTheme.ApplyTheme(this);

            properties = PropertyService.Get("MonoDevelop.FindReplaceDialogs.SearchOptions", new Properties());
            SetButtonIcon(toggleReplaceInFiles, "gtk-find-and-replace");
            SetButtonIcon(toggleFindInFiles, "gtk-find");

            // If we have an active floating window, attach the dialog to it. Otherwise use the main IDE window.
            var current_toplevel = Gtk.Window.ListToplevels().FirstOrDefault(x => x.IsActive);

            if (current_toplevel is Components.DockNotebook.DockWindow)
            {
                TransientFor = current_toplevel;
            }
            else
            {
                TransientFor = IdeApp.Workbench.RootWindow;
            }

            toggleReplaceInFiles.Active = showReplace;
            toggleFindInFiles.Active    = !showReplace;

            toggleFindInFiles.Toggled += delegate {
                if (toggleFindInFiles.Active)
                {
                    Title = GettextCatalog.GetString("Find in Files");
                    HideReplaceUI();
                }
            };

            toggleReplaceInFiles.Toggled += delegate {
                if (toggleReplaceInFiles.Active)
                {
                    Title = GettextCatalog.GetString("Replace in Files");
                    ShowReplaceUI();
                }
            };

            buttonSearch.Clicked += HandleSearchClicked;
            buttonClose.Clicked  += (sender, e) => Destroy();
            DeleteEvent          += (o, args) => Destroy();
            buttonSearch.GrabDefault();

            buttonStop.Clicked += ButtonStopClicked;
            var scopeStore = new ListStore(typeof(string));

            var workspace = IdeApp.Workspace;

            if (workspace != null && workspace.GetAllSolutions().Count() == 1)
            {
                scopeStore.AppendValues(GettextCatalog.GetString("Whole solution"));
            }
            else
            {
                scopeStore.AppendValues(GettextCatalog.GetString("All solutions"));
            }
            scopeStore.AppendValues(GettextCatalog.GetString("Current project"));
            scopeStore.AppendValues(GettextCatalog.GetString("All open files"));
            scopeStore.AppendValues(GettextCatalog.GetString("Directories"));
            scopeStore.AppendValues(GettextCatalog.GetString("Current document"));
            scopeStore.AppendValues(GettextCatalog.GetString("Selection"));
            comboboxScope.Model = scopeStore;

            comboboxScope.Changed += HandleScopeChanged;

            InitFromProperties();

            if (showReplace)
            {
                toggleReplaceInFiles.Toggle();
            }
            else
            {
                toggleFindInFiles.Toggle();
            }

            if (IdeApp.Workbench.ActiveDocument != null)
            {
                var view = IdeApp.Workbench.ActiveDocument.GetContent <ITextView>(true);
                if (view != null)
                {
                    string selectedText = FormatPatternToSelectionOption(view.Selection.SelectedSpans.FirstOrDefault().GetText(), properties.Get("RegexSearch", false));
                    if (!string.IsNullOrEmpty(selectedText))
                    {
                        if (selectedText.Any(c => c == '\n' || c == '\r'))
                        {
//							comboboxScope.Active = ScopeSelection;
                        }
                        else
                        {
                            if (comboboxScope.Active == (int)SearchScope.Selection)
                            {
                                comboboxScope.Active = (int)SearchScope.CurrentDocument;
                            }
                            comboboxentryFind.Entry.Text = selectedText;
                        }
                    }
                    else if (comboboxScope.Active == (int)SearchScope.Selection)
                    {
                        comboboxScope.Active = (int)SearchScope.CurrentDocument;
                    }
                }
            }
            comboboxentryFind.Entry.SelectRegion(0, comboboxentryFind.ActiveText.Length);
            comboboxentryFind.GrabFocus();
            DeleteEvent += delegate { Destroy(); };
            UpdateStopButton();
            UpdateSensitivity();
            if (!buttonSearch.Sensitive)
            {
                comboboxScope.Active = (int)SearchScope.Directories;
            }

            Child.Show();
            updateTimer = GLib.Timeout.Add(750, delegate {
                UpdateSensitivity();
                return(true);
            });
            SetupAccessibility();
        }