// In your winform
    private void Form1_Load(object sender, EventArgs e)
    {
        yourClass = new YourClass();

        // Set selected object
        propertyGrid1.SelectedObject = yourClass;
    }
Example #2
0
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     if (singleton == null)
     {
         singleton = this;
     }
 }
Example #3
0
 public void Apply(YourClass instance)
 {
     instance.cash              = cash + 10;
     instance.winnings          = winnings + 10;
     instance.Cash.Text         = Convert.ToString(cash);
     instance.Winnings.Text     = Convert.ToString(winnings);
     instance.PairWin.BackColor = Color.Red;
     instance.Winner.Visible    = true;
 }
Example #4
0
     public List<SomeSortOfValidationItem> Validate(YourClass obj)
     {
         var results = new List<SomeSortOfValidationItem>()
 
         if (obj.YourProperty.Length >= 200)
         {
            results.Add(new SormSortOfValidationItem("YourProperty", "Length must be less than...");
         }
         //etc.
     }
Example #5
0
 public void Addpoint([FromBody] YourClass po)
 {
     var pointslist = db.Points.ToList();
     var res        = Similar(Convert.ToInt32(po.firstx), Convert.ToInt32(po.firsty));
     //Point newp = new Point();
     //newp.X = Convert.ToInt32(po.firstx);
     //newp.Y = Convert.ToInt32(po.firsty);
     //newp.PointId = pointslist.Count() + 1;
     ////var obj = po;
     //db.Points.Add(newp);
     //db.SaveChanges();
 }
 public override DataTemplate SelectTemplate(object item, DependencyObject container)
 {
     YourClass obj = (YourClass)item;
     if (obj.Type == "SomeType")
     {
         return Template1;
     }
     else
     {
         return Template2;
     }
 }
Example #7
0
    protected async override void OnStartup(StartupEventArgs e)
    {
        base.OnStartup(e);
        var yourDependency = await YourClass.CreateAsync();

        MainWindowViewModel vm         = new MainWindowViewModel(yourDependency);
        MainWindow          mainWindow = new WpfApplication4.MainWindow()
        {
            DataContext = vm
        };

        mainWindow.Show();
    }
Example #8
0
        static void Main(string[] args)
        {
            YourClass NameInSuperSpace    = new YourClass(); // need using Super;
            Great     NameInSmashingSpace = new Great();     // need using Super.Smashing;

            Fabulous.MyClass NameInFabulous = new Fabulous.MyClass();
            Console.WriteLine(NameInSuperSpace);
            Console.WriteLine(NameInSmashingSpace);
            Console.WriteLine(NameInFabulous);
            Console.WriteLine(NameInFabulous.NameInSmashingSpace);
            Console.WriteLine(NameInFabulous.S);
            Small.DoSomething(); // can used by using static Super.Smashing.Small;
            Console.ReadKey();
        }
Example #9
0
    static void Main()
    {
        MyClass obj1 = new MyClass();

        obj1.setFields(4, 5, 1);
        YourClass obj2 = new YourClass();

        obj2.setFields(3, 5, 54, "John");
        TheirClass obj3 = new TheirClass();

        obj3.setFields(6, 7, 6, "John", "Doe");

        obj1.printArithmeticMean();
        obj2.printArithmeticMean();
        obj3.printArithmeticMean();
    }
Example #10
0
        public void WhenRunning_ItShouldPerformOperation()
        {
            // Moq simply asks for what interface we wished our object used
            var operationPerformerMock = new Mock <IPerformOperation>();

            // Now, due to the parameterless constructor constraint, we'll have to do something
            // interesting in our implementation, but we need this for testing. There's multiple
            // ways we could deal with this problem, but the one I use involves multiple constructors
            var sut = new YourClass(operationPerformerMock.Object);

            // Oh, and "sut" means "System Under Test" :)
            sut.RunMe();

            // This Moq command verifies that our class (YourClass) calls the PerformOperation method on the interface
            // properly. We don't care about the parameter at this point.
            operationPerformerMock.Verify(o => o.PerformOperation(It.IsAny <Operations>()));
        }
    public static void Main()
    {
        YourClass c = new YourClass()
        {
            PropA = 1,
            PropB = 2,
            PropC = "ciao"
        };


        var propBValue = c.Field <int>("PropB");

        Console.WriteLine("PropB value: {0}", propBValue);

        var propCValue = c.Field <string>("PropC");

        Console.WriteLine("PropC value: {0}", propCValue);
    }
    public void TestMethod1()
    {
        var instance = new YourClass();

        // create an instance of IDbContext
        var context = new Mock <IDbContext>();
        // create an instance of IDbCommand
        var command = new Mock <IDbCommand>();

        // setup your context and what should be the return of any method you want
        context.Setup(c => c.GetDbCommand(It.IsAny <string>(), It.IsAny <string[]>())).Returns(command.Object);
        // call your method you want to test
        instance.InsertData(context.Object);
        // assert that context methods ar called
        context.Verify(c => c.Connect(), Times.Once);
        context.Verify(c => c.DisConnect(), Times.Once);
        context.Verify(c => c.GetDbCommand(It.IsAny <string>(), It.IsAny <string[]>()), Times.Once);
        // assert that command methods ar called
        command.Verify(c => c.ExecuteNonQuery(), Times.Once);
    }
Example #13
0
        static void Main(string[] args)
        {
            //var om = new OperationMain();
            //om.PlayMedia();

            //
            //UnityContainer Container = new UnityContainer();
            //Container.RegisterType<IMediaFile, MediaFile>();
            //Container.RegisterType<IPlayer, Player>();
            //var om = Container.Resolve<OperationMain>();
            //om.PlayMedia();

            IClass myClass   = new MyClass();
            IClass yourClass = new YourClass();

            Container.RegisterInstance <IClass>(myClass);
            Container.RegisterInstance <IClass>("yourClass", yourClass);
            Container.Resolve <IClass>().ShowInfo();
            Container.Resolve <IClass>("yourClass").ShowInfo();

            TransientLifetimeManagerCode();
            Console.WriteLine("");
            ContainerControlledLifetimeManagerCode();
            Console.WriteLine("");
            HierarchicalLifetimeManagerCode();
            Console.WriteLine("");
            PerResolveLifetimeManagerCode();
            Console.WriteLine("");
            PerThreadLifetimeManagerCode();
            //Thread.Sleep原因???
            Thread.Sleep(1000);
            Console.WriteLine("");
            ExternallyControlledLifetimeManagerCode();
            Console.WriteLine("");

            //IoC.InitializeWith(new DependencyResolverFactory());
            //IoC.ResolveAll<IView>();

            Console.ReadKey();
        }
Example #14
0
    public IHttpActionResult CreateFolder <T>(long parent, string foldername)
    {
        T result = YourClass.CreateFolder <T>(parent, foldername);

        return(Ok(result));
    }
Example #15
0
        public MyClass()
        {
            YourClass yc = new YourClass();

            yc.Run();
        }
Example #16
0
 public UsingClass()
 {
     _yourClass = new YourClass();
 }
Example #17
0
 internal SomeTextProperty(YourClass owner)
 {
     this.owner = owner;
 }
 public Nested(YourClass outer) { m_RefToOuterWorld = outer; }
Example #19
0
 public void StartItUp()
 {
      YourClass.Run("http://wwww.somewhere.net", ProcessResponse);
 }
Example #20
0
 public MyClass() {
     YourClass yc = new YourClass();
     yc.Run();
 }
Example #21
0
    public static void Example()
    {
        YourClass instance = JsonParser <YourClass>("YourJson");

        Debug.log(JsonUtility.ToJson(instance));
    }
Example #22
0
 static void Main(string[] args)
 {
     using (YourClass y = new YourClass())
     {
     }
 }
Example #23
0
 public bool IsApplicable(YourClass instance)
 {
     return(instance.PokerTwo == 2);
 }