public void RemoveTile(GnosisTileController tileController) { //Find sibling and grandparent GnosisSplitController parentSplitController = (GnosisSplitController)tileController.Parent; var siblingController = parentSplitController.ChildControllers.Find(x => x.ControlImplementation.ID != tileController.ControlImplementation.ID); GnosisSplitController grandparent = (GnosisSplitController)parentSplitController.Parent; //remove tile and sibling from current parent parentSplitController.RemoveChild(tileController); parentSplitController.RemoveChild(siblingController); //assign parent's name and order to sibling siblingController.ControlImplementation.Order = parentSplitController.ControlImplementation.Order; siblingController.ControlImplementation.GnosisName = parentSplitController.ControlImplementation.GnosisName; //replace current parent with the sibling grandparent.RemoveChild(parentSplitController); grandparent.AddChildController(siblingController); //redraw grandparent.BuildContent(); GnosisParentWindow parentWindow = (GnosisParentWindow)GlobalData.Singleton.ParentWindowController.ControlImplementation; GnosisXMLHelper.SaveParentWindow(parentWindow); }
//public string Device //{ // get // { // return ((GnosisParentWindow)ControlImplementation).Device; // } // //set // //{ // // ((GnosisParentWindow)ControlImplementation).Device = value; // //} //} //public string Orientation //{ // get // { // return ((GnosisParentWindow)ControlImplementation).Orientation; // } // set // { // if (value.Equals(GnosisSplitDetail.ORIENTATION_LANDSCAPE) || value.Equals(GnosisSplitDetail.ORIENTATION_PORTRAIT)) // { // ((GnosisParentWindow)ControlImplementation).Orientation = value; // OnPropertyChanged("Orientation"); // } // else // { // GlobalData.Instance.ErrorHandler.HandleError("Unrecognised orientation: " + value, "GnosisParentWindowController.Orientation.Set"); // } // } //} //public bool Visible //{ // get // { // return ((GnosisParentWindow)ControlImplementation).Visible; // } // //set // //{ // // ((GnosisParentWindow)ControlImplementation).Visible = value; // // OnPropertyChanged("Visible"); // //} //} public GnosisParentWindowController( GnosisParentWindow _parentWindow, // IGnosisParentWindowImplementation _parentWindowImplementation, GnosisEntityController _entityController) : base(_parentWindow, _entityController, null) { GlobalData.Singleton.ParentWindowController = this; }
public static void SaveParentWindow(GnosisParentWindow parentWindow) { //try //{ // XmlSerializer serializer = new XmlSerializer(typeof(GnosisParentWindow)) ; // using (TextWriter writer = GlobalData.Singleton.IOHelper.GetTextWriter()) // { // serializer.Serialize(writer, parentWindow); // } //} //catch (Exception ex) //{ // GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.InnerException.Message); //} }
public static GnosisParentWindow LoadGnosisParentWindow(StreamReader sr) { XmlSerializer serializer = new XmlSerializer(typeof(GnosisParentWindow)); GnosisParentWindow parentWindow = null; try { parentWindow = (GnosisParentWindow)serializer.Deserialize(sr); } catch (Exception ex) { GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.StackTrace); } sr.Close(); return(parentWindow); }
//private void ConnectServer_Background(object sender, DoWorkEventArgs e) //{ // GlobalData.Singleton.DatabaseConnection = new ServerConnection( // username, // password, // server, // systemURL, // "Gnosis_Dev_27_7", // "Desktop", // Environment.MachineName, // new GnosisErrorHandlerWPF(), // new GnosisIOHelperWPF()); // //Dispatcher.Invoke((Action)(() => // //{ // connected = GlobalData.Singleton.DatabaseConnection.Connect(); // if (connected) // { // GlobalData.Singleton.ApplicationManager = new GnosisApplicationManager( // // parentWindow, // GnosisController.OrientationType.LANDSCAPE, // // new GnosisImplementationCreatorWPF(), // // new GnosisIOHelperWPF(), // new GnosisSystemCommandsWPF(), // new StyleHelper()); // GlobalData.Singleton.SystemController.SetupSystem(); // // Dispatcher.BeginInvoke((Action)(() => // // { // GlobalData.Singleton.SystemController.SetupUI(); // // })); // //ExcelPropertyComparer propertyComparer = new ExcelPropertyComparer(); // } // // })); // ((GnosisParentWindow)GlobalData.Singleton.ParentWindowImplementation).Show(); //} private void ConnectToServer() { GlobalData.Singleton.DatabaseConnection = new ServerConnection( username, password, server, systemURL, "Gnosis_Dev_27_7", "Desktop", Environment.MachineName, new GnosisErrorHandlerWPF(), new GnosisIOHelperWPF()); connected = GlobalData.Singleton.DatabaseConnection.Connect(); if (connected) { GlobalData.Singleton.ApplicationManager = new GnosisApplicationManager( // parentWindow, GnosisController.OrientationType.LANDSCAPE, // new GnosisImplementationCreatorWPF(), // new GnosisIOHelperWPF(), new GnosisSystemCommandsWPF(), new StyleHelper()); GlobalData.Singleton.SystemController.SetupSystem(); GlobalData.Singleton.SystemController.SetupUI(); ((LoginDialog)GlobalData.Singleton.Login).Dispatcher.Invoke((Action)(() => { ((LoginDialog)GlobalData.Singleton.Login).Hide(); })); GnosisParentWindow parentWindow = (GnosisParentWindow)GlobalData.Singleton.ParentWindowImplementation; parentWindow.Closed += (sender2, e2) => parentWindow.Dispatcher.InvokeShutdown(); parentWindow.Show(); System.Windows.Threading.Dispatcher.Run(); } }