private void BuildSubstationGraph()
        {
            if (SelectedSubstation == null)
            {
                return;
            }

            Model.Substation selectedPst = SelectedSubstation;

            SelectedFider = null;

            MainWindow.Cursor = Cursors.Wait;
            State             = StateType.Building;

            ThreadStart threadStart = delegate()
            {
                try
                {
                    TMP.DWRES.Graph.FiderGraph substationGraph = GetSubstationGraph(selectedPst);
                    ModelGraph = substationGraph;
                }
                finally
                {
                    System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                    {
                        // получаем участки
                        LinesWithNames = Lines;

                        // сохраняем список тп
                        BuildTPList();

                        MainWindow.Cursor = Cursors.Arrow;
                        State             = StateType.Ready;

                        _currentGraphVariant = GraphVariant.Substation;
                    }));
                }
            };

            Thread thread = new Thread(threadStart);

            thread.Name     = "Build substation graph";
            thread.Priority = ThreadPriority.BelowNormal;
            thread.Start();
        }
        private void BuildFiderGraph()
        {
            if (SelectedFider == null)
            {
                return;
            }

            State             = StateType.Building;
            MainWindow.Cursor = Cursors.Wait;

            ThreadStart threadStart = delegate()
            {
                try
                {
                    TMP.DWRES.Graph.FiderGraph graph = GetFiderGraph(SelectedFider);
                    ModelGraph = graph;
                }
                finally
                {
                    System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
                    {
                        // получаем участки
                        Lines          = _dwh.GetLines(SelectedFider.ID);
                        LinesWithNames = _graphScheme.Lines;

                        // сохраняем список тп
                        BuildTPList();

                        MainWindow.Cursor    = Cursors.Arrow;
                        State                = StateType.Ready;
                        _currentGraphVariant = GraphVariant.Fider;
                    }));
                }
            };

            Thread thread = new Thread(threadStart);

            thread.Name     = "Build fider graph";
            thread.Priority = ThreadPriority.BelowNormal;
            thread.Start();
        }