private void Home_Click(object sender, RoutedEventArgs e) { Application app = App.Current; IS3MainWindow mw = app.MainWindow as IS3MainWindow; mw.SwitchToProjectListPage(); }
void MyMapView_Loaded(object sender, RoutedEventArgs e) { if (Projects == null) { LoadProjectList(); // switch to the default project if (Projects != null) { ProjectLocation loc = Projects.Locations.Find(i => i.Default == true); if (loc != null) { App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToMainFrame(loc.DefinitionFile); } } } if (Projects != null) { Envelope projectExtent = new Envelope(Projects.XMin, Projects.YMin, Projects.XMax, Projects.YMax); AddProjectsToMap(); //Map.ZoomTo(ProjectExtent); } }
async void MyMapView_MouseDown(object sender, MouseButtonEventArgs e) { try { _isHitTesting = true; Point screenPoint = e.GetPosition(MyMapView); Graphic graphic = await ProjectGraphicsLayer.HitTestAsync(MyMapView, screenPoint); if (graphic != null) { string definitionFile = graphic.Attributes["DefinitionFile"] as string; App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToMainFrame(definitionFile); } } catch (Exception ex) { } finally { _isHitTesting = false; } }
//右键项目,进入项目详情页 private void ViewMenu_Click(object sender, RoutedEventArgs e) { string _projectID = _selectGraphic.Attributes["ID"] as string; App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToMainFrame(_projectID); }
//登陆验证 private void LoginButton_Click(object sender, RoutedEventArgs e) { XDocument xml = XDocument.Load(Runtime.configurationPath); if ((LoginNameTB.Text == "") || (LoginPasswordTB.Password == "")) { MessageBox.Show("账号或密码不为空"); return; } if ((LoginNameTB.Text != xml.Root.Element("user").Value) || (LoginPasswordTB.Password != xml.Root.Element("password").Value)) { MessageBox.Show("账号或密码错误"); return; } App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToProjectListPage(); }
//登陆验证 private async void LoginButton_Click(object sender, RoutedEventArgs e) { string username = LoginNameTB.Text; string password = LoginPasswordTB.Password; Globals.oAuthClient = new Core.OAuthClient(); string token = await Globals.oAuthClient.Call_WebAPI_By_Resource_Owner_Password_Credentials_Grant(username, password); if (token != string.Empty) { App app = Application.Current as App; IS3MainWindow mw = (IS3MainWindow)app.MainWindow; mw.SwitchToProjectListPage(); } else { MessageBox.Show("账号或密码错误"); } }