public NavigationViewController(Window canvas, Grid navigationBar)
 {
     this.canvas = canvas;
     this.canvasGrid = canvas.FindName("Canvas") as Grid;
     this.navigationBar = navigationBar;
     this.leftButton = (Label)navigationBar.FindName("LeftButtonLabel");
     this.rightButton = (Label)navigationBar.FindName("RightButtonLabel");
     this.title = (Label)navigationBar.FindName("Title");
     ((StackPanel)(navigationBar.FindName("LeftButton"))).MouseDown += leftButton_MouseDown;
     ((StackPanel)(navigationBar.FindName("RightButton"))).MouseDown += rightButton_MouseDown;
 }
示例#2
0
        public static void ShowProgressBar(DependencyObject DO, Grid LayoutRoot)
        {
            myCanvas = LayoutRoot.FindName("modal") as Canvas;
            myProgressIndicator = SystemTray.GetProgressIndicator(DO);

            myCanvas.Visibility = Visibility.Visible;
            myProgressIndicator.IsVisible = true;
        }
 /// <summary>
 /// 1. 显示产品名和版本号
 /// </summary>
 /// <param name="layoutRoot">page上用于布局控件的容器</param>
 public override void AddVersionLabel(Grid layoutRoot)
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         string version = XSystemConfiguration.GetInstance().XFaceVersion + " " + XSystemConfiguration.GetInstance().BuildNumber;
         string product = XDocument.Load("WMAppManifest.xml").Root.Element("App").Attribute("Title").Value;
         XSplashScreenControl splash = layoutRoot.FindName("splash") as XSplashScreenControl;
         splash.SetDisplayInfo("version: " + version, "Product: " + product);
     });
 }
示例#4
0
        public MapMainViewModel()
        {
            //string licenseKey = "runtimelite,1000,rud1244207246,none,9TJC7XLS1MJPF5KHT033"; //그린텍
            //string licenseKey = "runtimelite,1000,rud9177830334,none,A3E60RFLTFM5NERL1040"; //kyun0828 free

            //ArcGISRuntimeEnvironment.SetLicense(licenseKey);


            loadedCmd = new RelayCommand <object>(delegate(object obj)
            {
                //뷰객체를 파라미터로 전달받기
                System.Windows.Controls.Grid divGrid = obj as System.Windows.Controls.Grid;

                this.mapView     = divGrid.FindName("mapView") as MapView;
                this.divLayer    = divGrid.FindName("divLayer") as Popup;
                this.ClearButton = divGrid.FindName("ClearButton") as Button;


                //지도초기화
                InitMap();


                //시설물레이어DIV 초기화작업
                InitDivLayer();

                CmmRun.InitUniqueValueRenderer();//렌더러초기생성작업


                //비트맵초기화(시설물상세DIV 아이콘)
                BitImg = new BitmapImage();

                //ShowShapeLayer(mapView, "BML_GADM_AS", true);
            });


            //레이어 ON/OFF
            chkCmd = new RelayCommand <object>(delegate(object obj)
            {
                Button doc = obj as Button;
                //IEnumerable<CheckBox> collection = doc.Children.OfType<CheckBox>();
                //CheckBox chkbox = collection.First();

                CheckBox chkbox = doc.Template.FindName("chkLayer", doc) as CheckBox;
                bool chk        = (bool)chkbox.IsChecked;

                ShowLocalServerLayer(mapView, doc.Tag.ToString(), chk);
                //ShowShapeLayer(mapView, doc.Tag.ToString(), chk);


                //선택된 레이어저장
                try
                {
                    if (chk)
                    {
                        _selectedLayerNms.Add(doc.Tag.ToString());
                        _selectedLayerNm = doc.Tag.ToString();
                    }
                    else
                    {
                        _selectedLayerNms.Remove(doc.Tag.ToString());
                        _selectedLayerNm = _selectedLayerNms.LastOrDefault();
                    }
                }
                catch (Exception) { }
            });

            //팝업레이어 토글처리
            toggleCmd = new RelayCommand <object>(delegate(object obj)
            {
                StackPanel spLayer = divLayer.FindName("spLayer") as StackPanel;
                System.Windows.Controls.Grid gridTitle = divLayer.FindName("gridTitle") as System.Windows.Controls.Grid;

                spLayer.Visibility = spLayer.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;

                if (spLayer.Visibility == Visibility.Collapsed)
                {
                    divLayer.Height = gridTitle.Height;
                }
                else
                {
                    divLayer.Height = gridTitle.Height + spLayer.Height;
                }
            });



            // 레이어스타일 Renderer 초기화 - shape방식에서만 사용함
            //InitUniqueValueRenderer();

            levelCmd = new RelayCommand <object>(delegate(object obj)
            {
                MessageBox.Show("MapScale - " + mapView.MapScale);
            });

            //GIS초기화
            resetCmd = new RelayCommand <object>(delegate(object obj)
            {
                //0.맵초기화
                InitMap();

                //1.로컬서버 재기동
                //Initialize_LocalServer();

                //2.레이어 클리어
                mapView.Map.OperationalLayers.Clear();


                //3.열여있는 시설물정보창 닫기
                popFct.IsOpen = false;

                TreeView treeLayer = obj as TreeView;

                //레이어div 체크해제
                foreach (CheckBox cb in FmsUtil.FindVisualChildren <CheckBox>(treeLayer))
                {
                    cb.IsChecked = false;
                }

                //선택된레이어 해제
                _selectedFeature = null;
                try
                {
                    CmmRun.layers[_selectedLayerNm].ClearSelection();
                }
                catch (Exception) { }
                _selectedLayerNms.Clear();
                _selectedLayerNm = "";


                // 행정구역 표시
                ShowLocalServerLayer(mapView, "BML_GADM_AS", true);
                //ShowShapeLayer(mapView, "BML_GADM_AS", true);
            });

            //시설물팝업에서 시설물메뉴화면 호출작업
            CallPageCmd = new RelayCommand <object>(delegate(object obj) {
                FctDtl fctDtl = obj as FctDtl;

                IRegionManager regionManager = FmsUtil.__regionManager;
                ViewsCollection views        = regionManager.Regions["ContentRegion"].ActiveViews as ViewsCollection;

                foreach (var v in views)
                {
                    MapArcObjView mapMainView = v as MapArcObjView;
                    //MainWinViewModel vm = ((System.Windows.Controls.Grid)((ContentControl)mapMainView.Parent).Parent).DataContext as MainWinViewModel;
                    break;
                }
            });

            //시설물편집창
            EditCmd = new RelayCommand <object>(delegate(object obj)
            {
                EditWinView view = new EditWinView();
                if (view.ShowDialog() is bool)
                {
                    //재조회
                }
            });



            //도형클리어처리
            clearCmd = new RelayCommand <object>(delegate(object obj)
            {
                // Remove all graphics from the graphics overlay
                _sketchOverlay.Graphics.Clear();

                // Disable buttons that require graphics
                ClearButton.IsEnabled = false;
            });
            completeCmd = new RelayCommand <object>(async delegate(object obj)
            {
                mapView.SketchEditor.Stop();
                //추가된 도형 저장처리

                //_selectedFeature.Geometry = _geometry;
                // Apply the edit to the feature table.
                await _selectedFeature.FeatureTable.UpdateFeatureAsync(_selectedFeature);
                _selectedFeature.Refresh();
                MessageBox.Show("Added feature ", "Success!");
            });
        }
 private static UIElement FindChildElementByNameOrType(Grid parent, string childName, Type childType)
 {
     UIElement element = parent.FindName(childName) as UIElement;
     if (element != null)
     {
         return element;
     }
     else
     {
         foreach (UIElement child in parent.Children)
         {
             if (childType.IsInstanceOfType(child))
             {
                 return child;
             }
         }
         return null;
     }
 }
示例#6
0
文件: GridTest.cs 项目: kangaroo/moon
		public void FindChildren ()
		{
			Grid grid = new Grid ();
			grid.Children.Add (new UserControl { Name = "a" });
			TestPanel.Children.Add (grid);
			Assert.IsNotNull (grid.FindName ("a"), "#1");
		}
示例#7
0
        public MapLayerViewModel()
        {
            loadedCmd = new RelayCommand <object>(delegate(object obj)
            {
                //뷰객체를 파라미터로 전달받기
                System.Windows.Controls.Grid divGrid = obj as System.Windows.Controls.Grid;

                this.mapView     = divGrid.FindName("mapView") as MapView;
                this.divLayer    = divGrid.FindName("divLayer") as Popup;
                this.ClearButton = divGrid.FindName("ClearButton") as Button;

                txtFTR_CDE = divGrid.FindName("txtFTR_CDE") as TextBox;
                txtFTR_IDN = divGrid.FindName("txtFTR_IDN") as TextBox;

                //지도초기화
                InitMap();


                //시설물레이어DIV 초기화작업
                InitDivLayer();

                InitUniqueValueRenderer();//렌더러초기생성작업


                //비트맵초기화(시설물상세DIV 아이콘)
                BitImg = new BitmapImage();
            });


            //레이어 ON/OFF
            chkCmd = new RelayCommand <object>(delegate(object obj)
            {
                Button doc = obj as Button;
                //IEnumerable<CheckBox> collection = doc.Children.OfType<CheckBox>();
                //CheckBox chkbox = collection.First();

                CheckBox chkbox = doc.Template.FindName("chkLayer", doc) as CheckBox;
                bool chk        = (bool)chkbox.IsChecked;

                //ShowLocalServerLayer(mapView, doc.Tag.ToString(), chk);
                ShowShapeLayer(mapView, doc.Tag.ToString(), chk);


                //선택된 레이어저장
                try
                {
                    if (chk)
                    {
                        _selectedLayerNms.Add(doc.Tag.ToString());
                        _selectedLayerNm = doc.Tag.ToString();
                    }
                    else
                    {
                        _selectedLayerNms.Remove(doc.Tag.ToString());
                        _selectedLayerNm = _selectedLayerNms.LastOrDefault();
                    }
                }
                catch (Exception) { }
            });

            //팝업레이어 토글처리
            toggleCmd = new RelayCommand <object>(delegate(object obj)
            {
                StackPanel spLayer = divLayer.FindName("spLayer") as StackPanel;
                System.Windows.Controls.Grid gridTitle = divLayer.FindName("gridTitle") as System.Windows.Controls.Grid;

                spLayer.Visibility = spLayer.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;

                if (spLayer.Visibility == Visibility.Collapsed)
                {
                    divLayer.Height = gridTitle.Height;
                }
                else
                {
                    divLayer.Height = gridTitle.Height + spLayer.Height;
                }
            });

            //팝업레이어 토글처리
            closeCmd = new RelayCommand <object>(delegate(object obj)
            {
                Popup divLayerInfo = obj as Popup;

                divLayerInfo.IsOpen = false;
            });


            // 레이어스타일 Renderer 초기화 - shape방식에서만 사용함
            //InitUniqueValueRenderer();

            //GIS초기화
            resetCmd = new RelayCommand <object>(delegate(object obj)
            {
                //0.맵초기화
                InitMap();

                //1.로컬서버 재기동
                //Initialize_LocalServer();

                //2.레이어 클리어
                mapView.Map.OperationalLayers.Clear();


                //3.열여있는 시설물정보창 닫기
                popFct.IsOpen = false;

                TreeView treeLayer = obj as TreeView;

                //레이어div 체크해제
                foreach (CheckBox cb in FmsUtil.FindVisualChildren <CheckBox>(treeLayer))
                {
                    cb.IsChecked = false;
                }
                //선택된레이어 해제
                _selectedLayerNms.Clear();
                _selectedLayerNm = "";
            });

            //시설물팝업에서 시설물메뉴화면 호출작업
            CallPageCmd = new RelayCommand <object>(delegate(object obj) {
                FctDtl fctDtl = obj as FctDtl;

                IRegionManager regionManager = FmsUtil.__regionManager;
                ViewsCollection views        = regionManager.Regions["ContentRegion"].ActiveViews as ViewsCollection;

                foreach (var v in views)
                {
                    MapLayerView mapMainView = v as MapLayerView;
                    //MainWinViewModel vm = ((System.Windows.Controls.Grid)((ContentControl)mapMainView.Parent).Parent).DataContext as MainWinViewModel;
                    break;
                }
            });

            //파일찾기버튼 이벤트
            ChgImgCmd = new RelayCommand <object>(delegate(object obj)
            {
                // 전달된 파라미터
                if (obj == null)
                {
                    Messages.ShowErrMsgBox("시설물코드가 존재하지 않습니다.");
                    return;
                }
                string _FTR_CDE = obj as string;

                // UniqueValueRenderer 자원해제
                //uniqueValueRenderer = new UniqueValueRenderer();
                //layers[_selectedLayerNm].ResetRenderer();

                // 파일탐색기 열기
                OpenFileDialog openFileDialog   = new OpenFileDialog();
                openFileDialog.Multiselect      = false;
                openFileDialog.Filter           = "All files (*.*)|*.*";
                openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                if (openFileDialog.ShowDialog() == true)
                {
                    //아이콘 파일경로
                    string icon_foler = Path.Combine(BizUtil.GetDataFolder(), "style_img");


                    FileInfo[] files = openFileDialog.FileNames.Select(f => new FileInfo(f)).ToArray();  //파일인포
                    foreach (FileInfo fi in files)
                    {
                        try
                        {
                            //해당이미지파일을 FTR_CDE ex)SA117 이름의파일로 복사
                            fi.CopyTo(Path.Combine(icon_foler, _FTR_CDE), true);
                        }
                        catch (Exception ex)
                        {
                            Messages.ShowErrMsgBox(ex.Message);
                        }
                        finally
                        {
                            //1.렌더러 재구성
                            InitUniqueValueRenderer();

                            //2.레이어의 렌더러 재세팅
                            foreach (string sel in _selectedLayerNms)
                            {
                                layers[sel].Renderer = uniqueValueRenderer.Clone();
                                layers[sel].RetryLoadAsync();
                            }

                            //3.팝업이미지소스 업데이트
                            BitImg = new BitmapImage(new Uri(Path.Combine(Path.Combine(BizUtil.GetDataFolder(), "style_img"), _FTR_CDE))).Clone();
                        }
                    }
                }
            });



            btnCmd = new RelayCommand <object>(async delegate(object obj)
            {
                Button btn = obj as Button;
                switch (btn.Content.ToString())
                {
                case "시설물편집":
                    //시설물편집팝업호출



                    break;


                default:
                    break;
                }
            });


            //도형클리어처리
            clearCmd = new RelayCommand <object>(delegate(object obj)
            {
                // Remove all graphics from the graphics overlay
                _sketchOverlay.Graphics.Clear();

                // Disable buttons that require graphics
                ClearButton.IsEnabled = false;
            });
            completeCmd = new RelayCommand <object>(async delegate(object obj)
            {
                mapView.SketchEditor.Stop();
                //추가된 도형 저장처리

                _selectedFeature.Geometry = _geometry;
                // Apply the edit to the feature table.
                await _selectedFeature.FeatureTable.UpdateFeatureAsync(_selectedFeature);
                _selectedFeature.Refresh();
                MessageBox.Show("Added feature ", "Success!");
            });

            //시설물찾기
            //findCmd = new RelayCommand<object>(FindAction);
        }
示例#8
0
 private void programNameViewMode(Grid parentGrid)
 {
     //切换到查看方案名的模式.
     TextBlock programNameTextBlock = parentGrid.FindName("ProgramNameTextBlock") as TextBlock;
     Grid programNameGrid = parentGrid.FindName("ProgramNameGrid") as Grid;
     TextBox programNameTextBox = programNameGrid.FindName("ProgramNameTextBox") as TextBox;
     string name = programNameTextBox.Text;
     programNameTextBlock.Visibility = System.Windows.Visibility.Visible;
     programNameGrid.Visibility = System.Windows.Visibility.Collapsed;
     StackPanel stackPanel = parentGrid.Parent as StackPanel;
     TextBlock programIDTextBlock = stackPanel.FindName("ProgramIDTextBlock") as TextBlock;
     int programID = Int32.Parse(programIDTextBlock.Text);
     foreach (Program program in programList)
     {
         if (program.id == programID)
         {
             program.name = name;
             program.update();
             break;
         }
     }
 }
示例#9
0
 public UpdateHelper(Grid grid, DispatcherTimer timer)
     : this()
 {
     _grid = grid;
     _progressBar = grid.FindName("proBar") as ProgressBar;
     _tbProgressInfo = grid.FindName("tbProcess") as TextBlock;
     _progressBar.Maximum = _fileNum;
     _timer = timer;
     _fileBackupList = new List<Tuple<string, string>>();
 }
 private object GetControl(Grid parent, string controlName)
 {
     if (parent != null)
     {
         return parent.FindName(controlName);
     }
     return null;
 }
 private BindingExpression UpdateBinding(String controlName, Grid sender, DependencyProperty dp)
 {
     BindingExpression expression = ((TextBox)(sender.FindName(controlName))).GetBindingExpression(dp);
     expression.UpdateSource();
     return expression;
 }
        private void Grid_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            try
            {
                if (grid != null)
                {

                    TextBlock tb1 = (TextBlock)grid.FindName("tbSongTitle");
                    tb1.Foreground = new SolidColorBrush(Colors.White);
                }
                grid = (Grid)sender;
                TextBlock tb = (TextBlock)grid.FindName("tbSongTitle");
                tb.Foreground = myAnimatedBrush;
                myStoryboard.Begin();


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#13
0
 public static void ShowModalCanvas(Grid LayoutRoot)
 {
     myCanvas = LayoutRoot.FindName("modal") as Canvas;
     myCanvas.Visibility = Visibility.Visible;
 }