async void CopyFiltToResourceFolder(StorageFile f) { var folder = await GetResourceFolder(); if (folder != null) { try { var item = await folder.GetItemAsync(f.Name); CommonProc.ShowMessage("Error", "File named " + f.Name + " have already exist in folder"); return; } catch (FileNotFoundException) { } await f.CopyAsync(folder); } else { try { CommonProc.ShowMessage("Error", "no valid folder for copy"); } catch (Exception e) { LogSupport.Error(e); } } }
void ProcessLink(object data, Point point) { if (data == null) { return; } var l = DesignManager.GetDesignLink(data); if (l == null) { return; } var s = GetItemByID(l.Item1); var t = GetItemByID(l.Item2); if (s == null && t == null) { CommonProc.ShowMessage("Error", "Link source item and target item does not exist in diagram"); return; } if (s == null) { var control = DesignManager.CreateDesignControl(s); Canvas.SetLeft(control, point.X); Canvas.SetTop(control, point.Y); Draw(control); if (DesignManager.IsAutoConnectNode != null && DesignManager.IsAutoConnectNode()) { AutoAddConnection(control); } } if (t == null) { var control = DesignManager.CreateDesignControl(t); Canvas.SetLeft(control, point.X); Canvas.SetTop(control, point.Y); Draw(control); if (DesignManager.IsAutoConnectNode != null && DesignManager.IsAutoConnectNode()) { AutoAddConnection(control); } } Connect(l); }
async Task <StorageFolder> GetResourceFolder() { var name = TargetObject.Name + "(" + TargetObject.ObjectID.ToString() + ")"; var baseFolder = await MainViewModel.mainViewModel.GetAssertFolder(); if (baseFolder == null) { CommonProc.ShowMessage("Error", "No resource folder"); return(null); } StorageFolder f; try { f = await baseFolder.GetFolderAsync(name); } catch (FileNotFoundException) { f = await baseFolder.CreateFolderAsync(name); } return(f); }