///-------------------------------------------------------------------------------- /// <summary>This method updates the view model data and sends update command back /// to the solution builder.</summary> ///-------------------------------------------------------------------------------- protected override void OnUpdate() { // send update for any updated children foreach (ModelObjectViewModel item in ModelObjects) { if (item.IsEdited == true) { item.Update(); } } // send update for any new children foreach (ModelObjectViewModel item in ItemsToAdd.OfType <ModelObjectViewModel>()) { item.Update(); ModelObjects.Add(item); } ItemsToAdd.Clear(); // send delete for any deleted children foreach (ModelObjectViewModel item in ItemsToDelete.OfType <ModelObjectViewModel>()) { item.Delete(); ModelObjects.Remove(item); } ItemsToDelete.Clear(); // reset modified for children foreach (ModelObjectViewModel item in ModelObjects) { item.ResetModified(false); } }
static public void Create(IModel appModel, ModelObjects modelObjects, LogJoint.UI.Presenters.IPresentation appPresentation) { var stateInspectorPresenter = appPresentation.Postprocessing.StateInspector; stateInspectorPresenter.OnNodeCreated += (senderPresenter, arg) => { if (Rtc.MeetingsStateInspector.ShouldBePresentedCollapsed(arg.NodeObject?.CreationEvent)) { arg.CreateCollapsed = true; } else if (Rtc.MediaStateInspector.ShouldBePresentedCollapsed(arg.NodeObject?.CreationEvent)) { arg.CreateCollapsed = true; } }; stateInspectorPresenter.OnMenu += (senderPresenter, arg) => { if (stateInspectorPresenter.SelectedObject != null) { var menuItems = new [] { GoToTimeSeriesMenu.CreateStateInspectorMenuItem( stateInspectorPresenter.SelectedObject, appPresentation.Postprocessing.TimeSeries), DownloadBackendLogsMenu.CreateStateInspectorMenuItem( stateInspectorPresenter.SelectedObject, appPresentation.PromptDialog, appModel.Preprocessing.Manager, modelObjects.BackendLogsPreprocessingStepsFactory) }; arg.Items.AddRange(menuItems.Where(i => i != null)); } }; }
public ViewsFactory( MainWindowAdapter mainWindow, ModelObjects model ) { this.mainWindow = mainWindow; this.model = model; }
private void button1_Click(object sender, EventArgs e) { try { SCAPI.Application app = new SCAPI.Application(); SCAPI.PersistenceUnits units = app.PersistenceUnits; Sessions sessions = app.Sessions; Session session = sessions.Add(); foreach (PersistenceUnit unit in units) { MessageBox.Show(unit.Name); session.Open(unit, null, null); } ModelObjects models = session.ModelObjects; MessageBox.Show("갯수 " + models.Count); foreach (ModelObject model in models) { if (model.ClassName == "Entity" && !string.IsNullOrEmpty(model.Name)) { ModelProperties properties = model.Properties; foreach (ModelProperty property in properties) { //MessageBox.Show(property.ClassName + "," + property.FormatAsString()); object trid = session.BeginTransaction(); if (property.ClassName == "Name") { property.set_Value(null, null, "TEST"); //PropertyValue value = new PropertyValue(); //property.FormatAsString() } //MessageBox.Show(model.Name + "," + property.ClassName + "," + property.PropertyValues.ToString()); session.CommitTransaction(trid); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static PresentationObjects Create( ModelObjects model, IClipboardAccess clipboardAccess, IShellOpen shellOpen, IAlertPopup alertPopup, IFileDialogs fileDialogs, IPromptDialog promptDialog, About.IAboutConfig aboutConfig, MainForm.IDragDropHandler dragDropHandler, ISystemThemeDetector systemThemeDetector, IViewsFactory views ) { T callOptionalFactory <T>(Func <T> factory) where T : class
///-------------------------------------------------------------------------------- /// <summary>This method disposes of resources in the view model.</summary> ///-------------------------------------------------------------------------------- protected override void OnDispose() { if (ModelObjects != null) { foreach (ModelObjectViewModel itemView in ModelObjects) { itemView.Updated -= Children_Updated; itemView.Dispose(); } ModelObjects.Clear(); ModelObjects = null; } Model = null; base.OnDispose(); }
private void Awake() { Models = new List <Model>(); // scene上に存在するモデルを全て検出し、その個数に応じてターンテーブルに等間隔で配置する ModelObjects = GameObject.FindGameObjectsWithTag("Model").ToList(); float degree = 0f; ModelObjects.ForEach(model => { degree += circumference / currentModelCount; Debug.Log(degree); model.transform.RotateAround(transform.position, Vector3.up, degree); // Scene上に存在するモデルからModelクラスを取得、対象モデルを適当に代入しておく Models.Add(model.GetComponent <Model>()); }); TargetModel = Models.First(); }
///-------------------------------------------------------------------------------- /// <summary>This method loads ModelObjects into the view model.</summary> /// /// <param name="model">The model to load.</param> /// <param name="solution">The associated solution.</param> /// <param name="loadChildren">Flag indicating whether to perform a deeper load.</param> ///-------------------------------------------------------------------------------- public void LoadModelObjects(Model model, Solution solution, bool loadChildren = true) { // attach the items Items.Clear(); if (ModelObjects == null) { ModelObjects = new EnterpriseDataObjectList <ModelObjectViewModel>(); } if (loadChildren == true) { foreach (ModelObject item in model.ModelObjectList) { ModelObjectViewModel itemView = new ModelObjectViewModel(item, solution); itemView.Updated += new EventHandler(Children_Updated); ModelObjects.Add(itemView); Items.Add(itemView); } } }
///-------------------------------------------------------------------------------- /// <summary>This method applies modelobject updates.</summary> ///-------------------------------------------------------------------------------- public void ProcessEditModelObjectPerformed(ModelObjectEventArgs data) { try { bool isItemMatch = false; if (data != null && data.ModelObject != null) { foreach (ModelObjectViewModel item in ModelObjects) { if (item.ModelObject.ModelObjectID == data.ModelObject.ModelObjectID) { isItemMatch = true; item.ModelObject.TransformDataFromObject(data.ModelObject, null, false); item.OnUpdated(item, null); item.ShowInTreeView(); break; } } if (isItemMatch == false) { // add new ModelObject data.ModelObject.Model = Model; ModelObjectViewModel newItem = new ModelObjectViewModel(data.ModelObject, Solution); newItem.Updated += new EventHandler(Children_Updated); ModelObjects.Add(newItem); Model.ModelObjectList.Add(newItem.ModelObject); Solution.ModelObjectList.Add(newItem.ModelObject); Items.Add(newItem); OnUpdated(this, null); newItem.ShowInTreeView(); } } } catch (Exception ex) { ShowIssue(ex.Message + ex.StackTrace); } }
public static PresentationObjects Create( ModelObjects model, LogJoint.UI.Presenters.IPresentation appPresentation, IModel appModel, IViewsFactory viewsFactory) { appPresentation.NewLogSourceDialog.PagesRegistry.RegisterPagePresenterFactory( "wireshark", f => new NewLogSourceDialog.Pages.WiresharkPage.Presenter( viewsFactory.CreateWiresharkPageView(), appModel.Preprocessing.Manager, appModel.Preprocessing.StepsFactory, model.TShark ) ); appPresentation.MessagePropertiesDialog.ExtensionsRegistry.Register( new MessagePropertiesDialog.Extension(model.PostprocessorsRegistry, viewsFactory.CreateMessageContentView, appPresentation.ClipboardAccess) ); return(new PresentationObjects { }); }
public ViewsFactory(UI.MainForm mainForm, ModelObjects model) { this.mainForm = mainForm; this.winFormsComponentsInitializer = mainForm; this.model = model; }
///-------------------------------------------------------------------------------- /// <summary>This method deletes an instance of ModelObject from the view model.</summary> /// /// <param name="itemView">The ModelObject to delete.</param> ///-------------------------------------------------------------------------------- public void DeleteModelObject(ModelObjectViewModel itemView) { itemView.Updated -= Children_Updated; ModelObjects.Remove(itemView); Delete(itemView); }
///-------------------------------------------------------------------------------- /// <summary>This method adds an instance of ModelObject to the view model.</summary> /// /// <param name="itemView">The ModelObject to add.</param> ///-------------------------------------------------------------------------------- public void AddModelObject(ModelObjectViewModel itemView) { itemView.Updated += new EventHandler(Children_Updated); ModelObjects.Add(itemView); Add(itemView); }
///-------------------------------------------------------------------------------- /// <summary>This method applies modelobject deletes.</summary> ///-------------------------------------------------------------------------------- public void ProcessDeleteModelObjectPerformed(ModelObjectEventArgs data) { try { bool isItemMatch = false; if (data != null && data.ModelObject != null) { foreach (ModelObjectViewModel item in ModelObjects.ToList <ModelObjectViewModel>()) { if (item.ModelObject.ModelObjectID == data.ModelObject.ModelObjectID) { // remove item from tabs, if present WorkspaceEventArgs message = new WorkspaceEventArgs(); message.ItemID = item.ModelObject.ModelObjectID; Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message); // delete children for (int i = item.Items.Count - 1; i >= 0; i--) { if (item.Items[i] is ModelPropertyViewModel) { ModelPropertyViewModel child = item.Items[i] as ModelPropertyViewModel; ModelPropertyEventArgs childMessage = new ModelPropertyEventArgs(); childMessage.ModelProperty = child.ModelProperty; childMessage.ModelObjectID = item.ModelObject.ModelObjectID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.ProcessDeleteModelPropertyPerformed(childMessage); } } // delete item isItemMatch = true; ModelObjects.Remove(item); Model.ModelObjectList.Remove(item.ModelObject); Items.Remove(item); Model.ResetModified(true); OnUpdated(this, null); #region protected // refresh solution ModelEventArgs deleteMessage = new ModelEventArgs(); deleteMessage.Solution = Solution; deleteMessage.SolutionID = Solution.SolutionID; deleteMessage.ModelID = item.ModelID; Mediator.NotifyColleagues <ModelEventArgs>(MediatorMessages.Command_ReloadModelDataRequested, deleteMessage); #endregion protected break; } } if (isItemMatch == false) { ShowIssue(DisplayValues.Issue_DeleteItemNotFound); } } } catch (Exception ex) { ShowIssue(ex.Message + ex.StackTrace); } }
/// <summary> /// creates a new drawing panel with a world object /// </summary> /// <param name="w"></param> public DrawingPanel(ModelObjects w) : base() { DoubleBuffered = true; TheDisplayModel = w; }