public RuntimeApplicationProperties(RuntimeApplicationItem runtimeApplication) { Name = Extensions.Workbench.Documents.RuntimeApplicationProperties; //Memento = runtimeApplication.RuntimeApplication.RuntimeId.ToString(); //Title = runtimeApplication.RuntimeApplication.Code.ToString(); RuntimeApplication = runtimeApplication; //m_editRuntimeApplication = runtimeApplication.RuntimeApplication; }
public void AddRuntimeApplication(RuntimeApplicationItem rta) { Solution = Solution.NodeRuntimeApplicationChildren.Append( rta.RuntimeApplication); HookupHandlers(rta); m_Items.Add(rta); rta.IsSelected = true; }
/// <summary> /// Displays the Dialog as modal /// </summary> /// <returns>true if we are in sync</returns> public bool ShowDialog(RuntimeApplicationItem runtimeApplicationItem) { if (runtimeApplicationItem == null || runtimeApplicationItem.Runtime == null || runtimeApplicationItem.RuntimeApplication == null) { return(false); } m_inSync = false; if (runtimeApplicationItem.Runtime.RuntimeId() != runtimeApplicationItem.RuntimeApplication.RuntimeId) { // not even the same application Message = Resources.Strings.UploadDownloadDialog_Message_ApplicationMismatch; } else if (runtimeApplicationItem.Runtime.RuntimeVersionId() != runtimeApplicationItem.RuntimeApplication.ID) { // same application but versions don't match Message = Resources.Strings.UploadDownloadDialog_Message_VersionMismatch; } else { throw new InvalidOperationException(); } Window dlg = new UploadDownloadDialogView(); dlg.Owner = mainWindowExport.Value; this.m_Upload = true; // default to upload dlg.DataContext = this; dlg.ShowDialog(); if (m_inSync) { // user clicked ok if (Upload) { var rta = runtimeApplicationItem.Runtime.RuntimeApplicationUpload(); if (rta != null) { runtimeApplicationItem.RuntimeApplication = rta; // after an upload we have to reset the whole tree layoutManager.CloseAllDocuments(); runtimeApplicationItem.SetItems(); } else { m_inSync = false; } } else // download { m_inSync = runtimeApplicationItem.Runtime .RuntimeApplicationDownload(runtimeApplicationItem.RuntimeApplication, onlineChange: false); } } return(m_inSync); }
public void Save() { if (RuntimeApplication == null) { // it's a new one RuntimeApplication = new RuntimeApplicationItem(null, m_editRuntimeApplication); rootSolutionItem.AddRuntimeApplication(RuntimeApplication); } else { // it's an existing one RuntimeApplication.RuntimeApplication = m_editRuntimeApplication; } }
public DeviceConfigurationItem(RuntimeApplicationItem runtimeApplicationItem, NodeDeviceConfiguration deviceConfiguration) : base(runtimeApplicationItem, Resources.Strings.Solution_Pad_DeviceConfigurationItem_Header) { if (runtimeApplicationItem == null) { throw new ArgumentNullException(); } m_runtimeApplicationItem = runtimeApplicationItem; ContextMenu = extensionService.Sort(contextMenu); DeviceConfiguration = deviceConfiguration; SetIconFromBitmap(Resources.Images.DeviceConfiguration); }
/// <summary> /// Assumes the memento is the RuntimeId (FieldGuid) /// </summary> /// <param name="memento"></param> /// <returns></returns> public override IDocument CreateDocument(string memento) { if (memento == null) { // They want to create a new runtime application (not saved yet) var rtp = new RuntimeApplicationProperties(); rtp.Title = Resources.Strings.RuntimeApplication_NewTitle; rtp.m_editRuntimeApplication = NodeRuntimeApplication.BuildWith( new FieldIdentifier(Resources.Strings.RuntimeApplication_Code_Default), // Code new FieldGuid(firstRuntimeId()), // TypeId new FieldGuid(), // RuntimeId new FieldString(), // Address new FieldBase64(), // Configuration new FieldBool(false)); // ExecuteOnStartup return(rtp); } if (!m_docs.ContainsKey(memento)) { RuntimeApplicationItem item = null; foreach (var solutionItem in rootSolutionItem.Items) { RuntimeApplicationItem itemTest = solutionItem as RuntimeApplicationItem; if (itemTest != null) { if (itemTest.RuntimeApplication.RuntimeId.ToString() == memento) { item = itemTest; break; } } } if (item != null) { RuntimeApplicationProperties rtp = new RuntimeApplicationProperties(item); m_docs.Add(rtp.Memento, rtp); } else { return(null); } } return(m_docs[memento]); }
private void setItems() { var newCollection = new ObservableCollection <INodeWrapper>(); if (Solution != null) { foreach (NodeRuntimeApplication app in Solution.NodeRuntimeApplicationChildren.Items) { var rta = FindItemByNodeId(app.ID) as RuntimeApplicationItem; if (rta == null) { rta = new RuntimeApplicationItem(this, app); HookupHandlers(rta); } newCollection.Add(rta); } } Items = newCollection; }
public Tuple <NodePage, NodeRuntimeApplication> FindParentPageAndRuntimeApp(INodeWrapper requester) { var tpl = FindParentPageEditorItemPageItemAndRuntimeAppItem(requester); PageEditor.PageEditorItem pageEditorItem = tpl.Item1; PageItem pageItem = tpl.Item2; RuntimeApplicationItem runtimeAppItem = tpl.Item3; NodePage pg = null; NodeRuntimeApplication rta = null; if (pageEditorItem != null) { pg = pageEditorItem.WorkingCopy; } else if (pageItem != null) { pg = pageItem.Page; } if (runtimeAppItem != null) { rta = runtimeAppItem.RuntimeApplication; } return(new Tuple <NodePage, NodeRuntimeApplication>(pg, rta)); }
void HookupHandlers(RuntimeApplicationItem rta) { rta.Parent = this; rta.Edited += new EditedHandler(RuntimeApplication_Edited); rta.Deleted += new DeletedHandler(RuntimeApplication_Deleted); }
/// <summary> /// Displays the Dialog as modal /// </summary> /// <returns>true if we are in sync</returns> public bool ShowDialog(RuntimeApplicationItem runtimeApplicationItem) { if (runtimeApplicationItem == null || runtimeApplicationItem.Runtime == null || runtimeApplicationItem.RuntimeApplication == null) { return false; } m_inSync = false; if (runtimeApplicationItem.Runtime.RuntimeId() != runtimeApplicationItem.RuntimeApplication.RuntimeId) { // not even the same application Message = Resources.Strings.UploadDownloadDialog_Message_ApplicationMismatch; } else if (runtimeApplicationItem.Runtime.RuntimeVersionId() != runtimeApplicationItem.RuntimeApplication.ID) { // same application but versions don't match Message = Resources.Strings.UploadDownloadDialog_Message_VersionMismatch; } else { throw new InvalidOperationException(); } Window dlg = new UploadDownloadDialogView(); dlg.Owner = mainWindowExport.Value; this.m_Upload = true; // default to upload dlg.DataContext = this; dlg.ShowDialog(); if (m_inSync) { // user clicked ok if (Upload) { var rta = runtimeApplicationItem.Runtime.RuntimeApplicationUpload(); if (rta != null) { runtimeApplicationItem.RuntimeApplication = rta; // after an upload we have to reset the whole tree layoutManager.CloseAllDocuments(); runtimeApplicationItem.SetItems(); } else { m_inSync = false; } } else // download { m_inSync = runtimeApplicationItem.Runtime .RuntimeApplicationDownload(runtimeApplicationItem.RuntimeApplication, onlineChange: false); } } return m_inSync; }
private void setItems() { var newCollection = new ObservableCollection<INodeWrapper>(); if (Solution != null) { foreach (NodeRuntimeApplication app in Solution.NodeRuntimeApplicationChildren.Items) { var rta = FindItemByNodeId(app.ID) as RuntimeApplicationItem; if (rta == null) { rta = new RuntimeApplicationItem(this, app); HookupHandlers(rta); } newCollection.Add(rta); } } Items = newCollection; }