Thursday, October 31, 2013

When you create an app for windows phone, Visual Studio adds frame rate counters to visualize rate properties. To disable those, we need to open App.xaml.cs and need to set a variable to false as seen below:

// Set it to for not to display the current frame rate counters.
Application.Current.Host.Settings.EnableFrameRateCounter = false;

All required information about these counters can be found at the address:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/gg588380(v=vs.105).aspx

Posted on 6:45 PM by Erdem

No comments

http://stackoverflow.com/questions/11914562/wp7-change-application-name


You change the Title of the app in the file called WMAppmanifest.xml. Inside the App xmlns-tag theres a field for Title.

Posted on 6:44 PM by Erdem

No comments

Sunday, August 04, 2013


In the following example, when the user hovers the mouse over the button, the form expands in y direction. When the user clicks on the button, the text on the button changes. 

        int size1 = 400;
        int adder = 50;

        public Form1()
        {
            InitializeComponent();
            this.button1.Text = " Change Item ";
            this.button1.Dock = DockStyle.Bottom;
            this.button1.Click +=button1_Click;
            this.button1.MouseHover += button1_Click_F2;

            this.Controls.Add(this.button1);


            this.dataGridView1.Dock = DockStyle.Top;
            this.Controls.Add(dataGridView1);
            this.Size = new Size(400, 200);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.button1.Text = " Button1 Click is called ";
        }

        private void button1_Click_F2(object sender, EventArgs e)
        {
            
            this.Size = new Size(400, size1);
            size1 = size1 + adder;
        }

Posted on 9:18 AM by Erdem

No comments

Saturday, August 03, 2013

I found this article helpful to understand the concept of the client with encapsulation

Basically, the client is the object that uses or inherits methods and fields from another object. For the ideal encapsulation case, the client should not have access to the fields that are used in the methods of the object. Therefore, the interface must be designed in a way to prevent direct access to dynamic content of the inherited object or interface.

http://www.stanford.edu/class/cs108/handouts122/10OOPEncapsulation.pdf



Posted on 5:13 PM by Erdem

No comments

Friday, July 12, 2013

 public class Ulke
    {
        public int nufus;
        public int yuzolcumu;
        public string komsular;
        public void Denizler() { }
    }

    public class Sehir:Ulke
    {
        //Inheritance ornegi
        public int ilcesayisi;
        public  int otobussayisi;

    }

    class Program
    {
        static void Main(string[] args)
        {
            Ulke Turkiye = new Ulke(); // Ulke turunde bir class olan Turkiye'yi construct etmis olalim
            Turkiye.komsular = "Suriye"; // Komsular field ini tanimla
            Turkiye.yuzolcumu = 783; // yuzolcumu field ini tanimla
            Turkiye.nufus = 74; // nufus fieldini tanimla

            Sehir Istanbul = new Sehir(); // Sehir turunde bir class olan Turkiye'yi construct etmis olalim

            Istanbul.nufus = 15; // Istanbul'un nufus fieldini tanimla
            Istanbul.komsular = "Yalova";
            Istanbul.ilcesayisi = 23; // Istanbul'un ilcesayisi field'ini tanimla

            //Polymorphism ornegi
            Ulke Karadeniz = Istanbul;
            // Karadeniz objesi Ulke turunde bir nesne ancak
            // Poly-morph ederek Istanbul'a ait ancak Ulkeden inherit edilmis fieldlari
            // Karadeniz inherit ediyor
            // Yani her ne kadar Karadeniz Sehirin ust classi olan Ulke classinda bir object de olsa
            // Sehir classinin bir nesnesi olan Istanbulun field larini almis oluyor

            Console.WriteLine(Karadeniz.nufus); // Istanbulun nufusu
            Console.WriteLine(Karadeniz.komsular); // Istanbulun komsulari
            //Console.WriteLine(Karadeniz.ilcesayisi) Istanbulun ilce sayisi tanimli oldugu halde Karadeniz Ulke
            // class'ina ait oldugundan dolayi ilcesayisi field'i olamaz.
            Console.ReadKey();

            //Ozetle polymorphism yeni yaratilan bir nesnenin, kendisinden once tanimlanmis
            //bir nesneden field lar alabilmesi ancak bu (field larin kopyalandigi) nesne ile
            //farkli siniflarda olabilmesidir.


        }
    }

Posted on 8:10 PM by Erdem

No comments

Thursday, July 11, 2013

In C# all methods must be declared inside a class. However, if you declare a method or field as static, you can call the method or access the fields by using the name of the lass. No instance is required.

class RFClass
    {
        public static double converter(double inp1)
        {
            return inp1 * 3;
        }
    }

dedigin zaman, main fonksiyon icindeyken asagidaki komut calisiyor;
 double d2 = RFClass.converter(423);



Creating a Shared Field in a class
-- Objenin icindeki variable a field denir

When defining a field, you can use the static keyword so the field becomes available to all methods in an object, hence becoming shared field.


Creating a static field with const Keyword
When you define a field with const keyword, it automatically becomes static - available to all methods or outside calls- but can not be changed since it's defined as a constant. You can only define int, double or string as a constant



Static Class
In order to use as a utility class, hold variables and call methods, you can also define a static class.



Ama sadece class'i static olarak define edip de field lari static olarak tanimlamazsak onlar otomatikman statik olmuyorlar.. Yani

    public static class StaticClass1
    {
        public int dem = 0;
        public double demd = 0.0412;
    }

dedigimizde, dem veya demd disardan accessible static variable lar olarak islemiyor.

Posted on 12:46 PM by Erdem

No comments

A constructor is a special method that runs automatically when you create an instance of a class. It has the same name as the class and it can take parameter but it can not return a value..

If you don't write your own constructor, the compiler will generate a constructor for you.

If a constructor is not public, it can't be used outside of a class and it can't be called by methods that are not a part of the class.

What's the use of making a constructor private:
  1. The constructor can only be accessed from static factory method inside the class itself. Singleton can also belong to this category.
  2. A utility class, that only contains static methods.

Overloading Constructors
You can overload constructors as you can overload any method.

Posted on 12:05 PM by Erdem

No comments

class Circle
{
              int radius;
              double Area()
              {
                            return Math.PI*radius*radius;
              }
}

Circle c;
c = new Circle();

// When you use new keyword to create an object, the runtime has to construct that object by using the definition of the class. A constructor is a special method that runs automatically when you create an instance of a class.

What is a constructor
What is instance of a class

Posted on 11:06 AM by Erdem

No comments

How much memory does a class use?
How much memory does a function use?

Posted on 10:36 AM by Erdem

No comments

Kisacasi encapsulation, classlarin bir kismini erisilebilir bir kismini erisilemez yaparak programcinin daha rahat bir sekilde class lari kullanmasini saglamaktir.

Posted on 10:30 AM by Erdem

No comments