private void CopyText()
 {
     if (Text.SelectedText.Length > 0)
     {
         Text.Copy();
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            var text = new Text();

            text.Width = 100;
            text.Copy();
        }
Example #3
0
        static void Main(string[] args)
        {
            // INHERITANCE
            // ===========

            var text = new Text();

            // Note that the methods that come for free when you create your classes and its derivations are the from the OBJECT CLASS.
            // All classes automatically inherit from the OBJECT class.

            text.Width = 100;
            text.Copy();



            // COMPOSITION
            // ===========

            var dbMigrator = new DbMigrator(new Logger());

            var logger    = new Logger();
            var installer = new Installer(logger);

            dbMigrator.Migrate();
            installer.Install();
        }
        private static void Inheritance()
        {
            var text = new Text();

            text.Width = 100;
            text.Copy();
        }
Example #5
0
        public override string SerializeToString()
        {
            Text t = (Text)m_Text.Copy();

            t.Escape();

            return(Encode(t.Value));
        }
Example #6
0
        ///////////////////////// Mostenire //////////////////////////////////

        static void InheritanceMethod()
        {
            var text = new Text();

            text.Width = 1;
            text.Copy();
            text.FontSize = 3;
        }
Example #7
0
        static void Main(string[] args)
        {
            var text = new Text();

            // now we have Width field and Copy method on Text class, because we inherited them from the parent class
            text.Width = 100;
            text.Copy();
        }
Example #8
0
        static void Main(string[] args)
        {
            var text = new Text();

            // We now hgave access to the properties
            // and methods in the parent class.
            text.Width = 100;
            text.Copy();
        }
Example #9
0
        static void Main(string[] args)
        {
            Text text = new Text();

            text.Width = 100;
            text.Copy();

            Console.ReadLine();
        }
Example #10
0
        private static void UseInheritance()
        {
            var text = new Text
            {
                Width = 100
            };

            text.Copy();
        }
Example #11
0
        public void UsePresentation()
        {
            var text = new Text();

            /* Member of the class */
            text.AddHyperlink("Member from text");
            text.FontSize = 12;

            /* Members from parent class PresentationObject */
            text.Width = 100;
            text.Copy();
        }
        private static void Main(string[] args)
        {
            var text = new Text();

            text.Width = 100;
            text.Copy();

            var logger    = new Logger();
            var migration = new DbMigrator(logger);

            migration.Migrate();
        }
Example #13
0
        public static void Main(string[] args)
        {
            var circle = new PresentationObject();

            circle.Height = 100;
            circle.Width  = 100;
            System.Console.WriteLine("Height: {0}", circle.Height);

            var text = new Text();

            text.Height = 10;
            System.Console.WriteLine("Height: {0}", text.Height);
            text.Copy();
        }
Example #14
0
        //Class Coupling ===============================================================================================
        #region Class Coupling

        /*
         * Class Coupling
         * A measure of how interconnected classes and subsystems are.
         * The more coupled classes, the harder it is to change them.
         * A change in one class may affect many other classes.
         * Loosely coupled software, as opposed to tightly coupled software, is easier to change.
         * Two types of relationships between classes: "Inheritance" and "Composition"
         *
         * Favour Composition over Inheritance :
         *
         * Problems with inheritance:
         *      • Easily abused by amateur designers / developers
         *      • Leads to large complex hierarchies
         *      • Such hierarchies are very fragile and a change may affect many classes
         *      • Results in tight coupling
         *
         * Benefits of composition:
         *      • Flexible
         *      • Leads to loose coupling
         *
         * Having said all that, it doesn’t mean inheritance should be avoided at all times.
         *      In fact, it’s great to use inheritance when dealing with very stable classes on top of small hierarchies.
         *      As the hierarchy grows (or variations of classes increase), the hierarchy, however, becomes fragile.
         *      And that’s where composition can give you a better design (Mosh Hamedani)
         */

        private void _Inheritance()
        {
            /*
             *  Inheritance :
             * A kind of relationship between two classes that allows one to inherit code from the other.
             * Referred to as Is-A relationship: A Car is a Vehicle
             * Benefits: code re-use and polymorphic behaviour.
             */

            // so the "text object" is have the Copy() method, which the originally Copy() method is in the "Presentation Class"
            // because the "Text class" inherited "Presentation Class" so the "text object" can have all their method and properties

            var text = new Text();

            text.Width = 200;
            text.Copy();
        }
Example #15
0
        static void Main()
        {
            //Inheritance
            var text = new Text
            {
                Width = 100
            };

            text.Copy();

            //Composition - relationship between two classes that allows one to contai the other.
            var dbMigrator = new DbMigrator(new Logger());
            var logger     = new Logger();
            var installer  = new Installer(logger);

            dbMigrator.Migrate();
            installer.Install();
        }
Example #16
0
        /// <summary>
        /// Inheritance (is-A relationship)and composition (has-A relationship) allows for code reuse.
        /// Problems with inheritance: easy abuse by amateur devs, large hierarchies, fragility and tight code coupling.
        /// Any inheritance relationship can be translated to composition, which has code flexibility and is loosely coupled.
        /// </summary>
        static void Main(string[] args)
        {
            // Inheritance in action
            var text = new Text();
            text.Width = 200;
            text.Height = 500;
            text.Copy();


            // Composition in acton
            var dbMigrator = new DbMigrator(new Logger());

            var logger = new Logger();
            var installer = new Installer(logger);

            dbMigrator.Migrate();
            installer.Install();

            Console.ReadLine();
        }
 static void Main(string[] args)
 {
     var text = new Text();
     text.Width = 100;
     text.Copy();
 }
Example #18
0
        static void Main(string[] args)
        {
            var textStuff = new Text();

            textStuff.Copy();
        }
Example #19
0
 private void Button_ClickCopy(object sender, RoutedEventArgs e)
 {
     Text.Copy();
 }