示例#1
0
        //Window structure initializtion.
        private void Initialize(string name)
        {
            var windowDecorator  = new WindowFactory();
            var instrumentViewer = new InstrumentViewer();

            //Getting instrument class information through it's name.
            //If window haven't been initialized than we use the type of the first instrument in list
            //because user haven't selected instrument type yet.
            if (name == null)
            {
                _instrumentInfo = instrumentViewer.GetInstrumentInfo(instrumentViewer.GetFirstTypeName());
            }
            //Else we get instrument class info from InstrumentViewer
            else
            {
                _instrumentInfo = instrumentViewer.GetInstrumentInfo(instrumentViewer.GetTypeThrowName(name));

                //Non-negative value means that instrument is already created and some properties
                //of object might be initialized, that's why we should display it.
                if (_index >= 0)
                {
                    new InstrumentFactory().Initialize(_instrumentInfo, _instruments[_index]);
                }
            }

            _instrumentInfo[0].Value = name;

            //Window structure creating.
            Content = new Grid();
            ((Grid)Content).Children.Add(windowDecorator.GetWindowContent(this, _instrumentInfo));

            OnListChanged();

            //_windowDecorator.Initialize();
        }