Click here to Skip to main content
11,577,710 members (51,107 online)
Click here to Skip to main content
Add your own
alternative version

User-driven applications

, 10 Apr 2010 CPOL 19.9K 77
User-driven applications are the programs in which full control is given to the users. Designers of such programs are responsible only for developing an instrument for solving some task, but they do not enforce users to work with this instrument according with a predefined scenario.
TheoryOfUserDrivenApplications.zip
TheoryOfUserDrivenApplications
TheoryOfUserDrivenApplications
bin
Debug
TheoryOfUserDrivenApplications.vshost.exe
Release
MoveGraphLibrary.dll
TheoryOfUserDrivenApplications.bin
TheoryOfUserDrivenApplications.exe
TheoryOfUserDrivenApplications.vshost.exe
Properties
Settings.settings
Resources
ArrowDown.bmp
ArrowUp.bmp
DELETE.BMP
Hangar.bmp
Lock.bmp
palette_.bmp
RuralHouse.bmp
RuralLeftPlus.bmp
RuralRightPlus.bmp
SimpleHouse.bmp
User_driven_applications.doc
User_driven_applications.pdf
using System;
using System .Collections .Generic;
using System .Drawing;
using System .Windows .Forms;
using Microsoft .Win32;

using MoveGraphLibrary;

namespace UserDrivenApplications
{
    public class SingleElement
    {
        MedleyElem rotelem;
        PieChart piechart;
        RingSet ringset;
        BarChart barchart;

        // -------------------------------------------------
        public SingleElement (PieChart pie)
        {
            rotelem = MedleyElem .PieChart;
            piechart = pie;
            ringset = null;
            barchart = null;
        }
        // -------------------------------------------------
        public SingleElement (RingSet rs)
        {
            rotelem = MedleyElem .RingSet;
            piechart = null;
            ringset = rs;
            barchart = null;
        }
        // -------------------------------------------------
        public SingleElement (BarChart bc)
        {
            rotelem = MedleyElem .BarChart;
            piechart = null;
            ringset = null;
            barchart = bc;
        }
        // -------------------------------------------------        ElementType
        public MedleyElem ElementType
        {
            get { return (rotelem); }
        }
        // -------------------------------------------------        PieChart
        public PieChart PieChart
        {
            get { return (piechart); }
        }
        // -------------------------------------------------        RingSet
        public RingSet RingSet
        {
            get { return (ringset); }
        }
        // -------------------------------------------------        BarChart
        public BarChart BarChart
        {
            get { return (barchart); }
        }
        // -------------------------------------------------        Inside
        public bool InsideMainArea (Point pt)
        {
            bool bRet = false;

            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    bRet = piechart .Inside (pt);
                    break;
                case MedleyElem .RingSet:
                    bRet = ringset .Inside (pt);
                    break;
                case MedleyElem .BarChart:
                    bRet = barchart .InsideMainArea (pt);
                    break;
            }
            return (bRet);
        }
        // -------------------------------------------------        Title
        public string Title
        {
            get
            {
                string str = "";

                switch (rotelem)
                {
                    case MedleyElem .PieChart:
                        str = piechart .Title;
                        break;
                    case MedleyElem .RingSet:
                        str = ringset .Title;
                        break;
                    case MedleyElem .BarChart:
                        str = barchart .Title;
                        break;
                }
                return (str);
            }
        }
        // -------------------------------------------------        SwitchBorders
        public void SwitchBorders ()
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .ShowBorders = !piechart .ShowBorders;
                    if (piechart .ParamsForm != null)
                    {
                        piechart .ParamsForm .RefreshViewPart (ViewPart .Border);
                    }
                    break;
                case MedleyElem .RingSet:
                    ringset .ShowBorders = !ringset .ShowBorders;
                    if (ringset .ParamsForm != null)
                    {
                        ringset .ParamsForm .RefreshViewPart (ViewPart .Border);
                    }
                    break;
            }
        }
        // -------------------------------------------------        SwitchFixingAngles
        public void SwitchFixingAngles (int iRing)
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .FixedSectorTextsAngles = !piechart .FixedSectorTextsAngles;
                    if (piechart .ParamsForm != null)
                    {
                        piechart .ParamsForm .RefreshViewPart (ViewPart .Angles);
                    }
                    break;
                case MedleyElem .RingSet:
                    RingArea ra = ringset .Rings [iRing];
                    ra .FixedSectorTextsAngles = !ra .FixedSectorTextsAngles;
                    if (ringset .ParamsForm != null && iRing == ringset .ParamsForm .CurrentRingNumber)
                    {
                        ringset .ParamsForm .RefreshViewPart (ViewPart .Angles);
                    }
                    break;
            }
        }
        // -------------------------------------------------        SwitchDrawingDirection
        public void SwitchDrawingDirection (int iRing)
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .ChangeDrawingDirection ();
                    break;
                case MedleyElem .RingSet:
                    ringset .Rings [iRing] .ChangeDrawingDirection ();
                    break;
            }
        }
        // -------------------------------------------------        HideSectorCmnts
        public void HideSectorCmnts (int iRing)
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .SectorCommentsVisibility = false;
                    break;
                case MedleyElem .RingSet:
                    ringset .Rings [iRing] .CommentsVisibility = false;
                    break;
            }
        }
        // -------------------------------------------------        UnveilSectorCmnts
        public void UnveilSectorCmnts (int iRing)
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .SectorCommentsVisibility = true;
                    break;
                case MedleyElem .RingSet:
                    ringset .Rings [iRing] .CommentsVisibility = true;
                    break;
            }
        }
        // -------------------------------------------------        HideGeneralCmnts
        public void HideGeneralCmnts ()
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .CommentsVisibility = false;
                    break;
                case MedleyElem .RingSet:
                    ringset .CommentsVisibility = false;
                    break;
                case MedleyElem .BarChart:
                    barchart .CommentsVisibility = false;
                    break;
            }
        }
        // -------------------------------------------------        UnveilGeneralCmnts
        public void UnveilGeneralCmnts ()
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .CommentsVisibility = true;
                    break;
                case MedleyElem .RingSet:
                    ringset .CommentsVisibility = true;
                    break;
                case MedleyElem .BarChart:
                    barchart .CommentsVisibility = true;
                    break;
            }
        }
        // -------------------------------------------------        CloseTuningForms
        public void CloseTuningForms ()
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .CloseTuningForm ();
                    break;
                case MedleyElem .RingSet:
                    ringset .CloseTuningForm ();
                    break;
                case MedleyElem .BarChart:
                    barchart .CloseTuningForms ();
                    break;
            }
        }
        // -------------------------------------------------        Draw
        public void Draw (Graphics grfx)
        {
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .Draw (grfx);
                    break;
                case MedleyElem .RingSet:
                    ringset .Draw (grfx);
                    break;
                case MedleyElem .BarChart:
                    barchart .Draw (grfx);
                    break;
            }
        }
        // -------------------------------------------------        IntoMover
        public void IntoMover (Mover mover, int iPos)
        {
            if (iPos < 0 || mover .Count < iPos)
            {
                return;
            }
            switch (rotelem)
            {
                case MedleyElem .PieChart:
                    piechart .IntoMover (mover, iPos);
                    break;
                case MedleyElem .RingSet:
                    ringset .IntoMover (mover, iPos);
                    break;
                case MedleyElem .BarChart:
                    barchart .IntoMover (mover, iPos);
                    break;
            }
        }
        // -------------------------------------------------        PositionsInMover
        public int PositionsInMover
        {
            get
            {
                int nPos = 0;
                switch (rotelem)
                {
                    case MedleyElem .PieChart:
                        nPos = piechart .PositionsInMover;
                        break;
                    case MedleyElem .RingSet:
                        nPos = ringset .PositionsInMover;
                        break;
                    case MedleyElem .BarChart:
                        nPos = barchart .PositionsInMover;
                        break;
                }
                return (nPos);
            }
        }

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

SergeyAndreyev
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150603.1 | Last Updated 10 Apr 2010
Article Copyright 2010 by SergeyAndreyev
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid