private static void InitUIElement <T, K>(CreateCallback createAction, OSCWindowControlCreator.ControlData data, MenuCommand menuCommand) where K : OSCTransmitterInformer where T : Component { if (createAction == null) { return; } var resources = OSCEditorUtils.GetStandardResources(); resources.Color = data.ControlColor; var element = createAction(resources); PlaceUIElement(element, menuCommand); if (data.UseInformer) { AddInformer <K>(element.GetComponent <T>(), data.InformerTransmitter, data.InformAddress, data.InformOnChanged, data.InformInterval); } }
private void Test <TVTable>( byte[] vtable, int expectedMaxIndex, int actualMaxIndex, CreateCallback <TVTable> callback) where TVTable : struct, IVTable { var buffer = new ArrayInputBuffer(vtable); callback(buffer, 0, out TVTable vt); Assert.Equal(expectedMaxIndex, vt.MaxSupportedIndex); for (int i = 0; i <= Math.Max(actualMaxIndex, expectedMaxIndex); ++i) { if (i <= Math.Min(actualMaxIndex, expectedMaxIndex)) { Assert.Equal(i, vt.OffsetOf(buffer, i)); } else { Assert.Equal(0, vt.OffsetOf(buffer, i)); } } Assert.Equal(0, vt.OffsetOf(buffer, vt.MaxSupportedIndex + 1)); Assert.Equal(0, vt.OffsetOf(buffer, -1)); }
public void CreateAssetBundleBuild(CreateCallback createCallback) { createCallback(new AssetBundleBuild() { assetBundleName = AssetBundleName, assetNames = AssetNames, }); }
protected async void CreateOrEditClick() { // 변경 내용 저장 Model.Name = ModelEdit.Name; Model.Title = ModelEdit.Title; Model.Content = ModelEdit.Content; Model.Password = ModelEdit.Password; #region 일 업로드 관련 추가 코드 영역 if (selectedFiles != null && selectedFiles.Length > 0) { // 파일 업로드 var file = selectedFiles.FirstOrDefault(); var fileName = ""; int fileSize = 0; if (file != null) { //file.Name = $"{DateTime.Now.ToString("yyyyMMddhhmmss")}{file.Name}"; fileName = file.Name; fileSize = Convert.ToInt32(file.Size); //[A] byte[] 형태 //var ms = new MemoryStream(); //await file.Data.CopyToAsync(ms); //await FileStorageManager.ReplyAsync(ms.ToArray(), file.Name, "", true); //[B] Stream 형태 //string folderPath = Path.Combine(WebHostEnvironment.WebRootPath, "files"); await FileStorageManagerReference.UploadAsync(file.Data, file.Name, "Memos", true); Model.FileName = fileName; Model.FileSize = fileSize; } } #endregion if (!int.TryParse(parentId, out int newParentId)) { newParentId = 0; } Model.ParentId = newParentId; Model.ParentKey = Model.ParentKey; if (Model.Id == 0) { // Create await RepositoryReference.AddAsync(Model); CreateCallback?.Invoke(); } else { // Edit await RepositoryReference.EditAsync(Model); await EditCallback.InvokeAsync(true); } //IsShow = false; // this.Hide() }
public void CreateAssetBundleBuild(CreateCallback createCallback) { string path = AssetDatabase.GetAssetPath(AssetFolder); createCallback(new AssetBundleBuild() { assetBundleName = BuildRuleUtil.PathToAssetBundleName(path), assetNames = new string[] { path }, }); }
protected async void CreateOrEditClick() { #region 일 업로드 관련 추가 var file = selectedFiles.FirstOrDefault(); var fileName = ""; int fileSize = 0; if (file != null) { //file.Name = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}{file.Name}"; fileName = file.Name; fileSize = Convert.ToInt32(file.Size); //await FileUploadServiceReference.UploadAsync(file); //[A] 바이트 형태 //var ms = new MemoryStream(); //await file.Data.CopyToAsync(ms); // 파일 데이터를 메모리스트림으로 변환 //// upload 하기전 memorystream을 byte 배열로 다시변환 //await FileStorageManager.UploadAsync(ms.ToArray(), file.Name, "", true); //[B] Stream형태 //string folderPath = Path.Combine(WebHostEnvironment.WebRootPath, "files"); await FileStorageManager.UploadAsync(file.Data, file.Name, "", true); Model.FileName = fileName; Model.FileSize = fileSize; } #endregion if (!int.TryParse(parentId, out int newParentId)) { newParentId = 0; } Model.ParentId = newParentId; //Model.ParentKey = Model.ParentKey; if (Model.Id == 0) { // Create await NoticeRepositoryAsyncReference.AddAsync(Model); CreateCallback?.Invoke(); // -> EditCallback } else { // Edit await NoticeRepositoryAsyncReference.EditAsync(Model); await EditCallback.InvokeAsync(true); } //IsShow = false; }
/// <summary> /// 创建代码块 /// </summary> protected void CreateCodeBox() { TreeData td = (TreeData)XTreeView.SelectedItem; ///如果不是最终节点则退出 if (td.IsDataNode == false) { return; } CreateCallback?.Invoke(td.Data); }
public void ReplaceMode(string newResouce, CreateCallback callback) { Globals.Instance.MResourceManager.Load(newResouce, delegate(Object obj, string error) { if (null == obj) { return; } GameObject.Destroy(_thisGameObject); _thisGameObject = GameObject.Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject; GameObject.DontDestroyOnLoad(_thisGameObject); LayerMaskDefine.SetLayerRecursively(_thisGameObject, LayerMaskDefine.REFLECTION); if (_warshipName != null) { _thisGameObject.name = _warshipName; } Animation am = _thisGameObject.GetComponent <Animation>(); if (am != null) { _mAnimationController = new AnimationController(am); } else { am = _thisGameObject.GetComponentInChildren <Animation>(); if (am != null) { _mAnimationController = new AnimationController(am); } } _emitEffectFontUtil = _thisGameObject.AddComponent <EmitEffectFontUtil>(); AddPropertyComp(); Create3DName(); CreateWarshipHeader(); Show3DName(false); InitializeAttachmentSlots(); if (null != callback) { callback(this); } IsLoaded = true; }); }
private static DescriptorSetCollection GetOrCreate <T>( CommandBufferScoped cbs, ref T key, Dictionary <T, DescriptorSetCollection> hashTable, CreateCallback <T> createCallback) { if (!hashTable.TryGetValue(key, out var ds)) { ds = createCallback(cbs, ref key); hashTable.Add(key, ds); } return(ds); }
public static void CreateAsync <T>(CreateCallback <T> createCallback, T userData, String[] sources, Devices devices, Context context, String buildOptions) { CLError error = CLError.None; CLProgram openclProgram = OpenCLDriver.clCreateProgramWithSource(context.CLContext, sources.Length, sources, GetLengths(sources), ref error); OpenCLError.Validate(error); Program program = new Program(openclProgram, sources, context, devices, buildOptions); program.AsyncHelperObject = new AsyncHelper <T>(program, createCallback, userData); OpenCLError.Validate(OpenCLDriver.clBuildProgram(openclProgram, devices.Count, devices.OpenCLDeviceArray, buildOptions, program.AsyncCallback, IntPtr.Zero)); }
public void CreateAssetBundleBuild(CreateCallback createCallback) { string path = AssetDatabase.GetAssetPath(AssetFolder); var folders = AssetDatabase.GetSubFolders(path); for (int i = 0; i < folders.Length; i++) { createCallback(new AssetBundleBuild() { assetBundleName = BuildRuleUtil.PathToAssetBundleName(folders[i]), assetNames = new string[] { folders[i] }, }); } }
protected async void CreateOrEditClick() { #region 일 업로드 관련 추가 var file = selectedFiles.FirstOrDefault(); var fileName = ""; int fileSize = 0; if (file != null) { //file.Name = $"{DateTime.Now.ToString("yyyyMMddHHmmss")}{file.Name}"; fileName = file.Name; fileSize = Convert.ToInt32(file.Size); await FileUploadServiceReference.UploadAsync(file); Model.FileName = fileName; Model.FileSize = fileSize; } #endregion if (!int.TryParse(parentId, out int newParentId)) { newParentId = 0; } Model.ParentId = newParentId; if (Model.Id == 0) { // Create await NoticeRepositoryAsyncReference.AddAsync(Model); CreateCallback?.Invoke(); // -> EditCallback } else { // Edit await NoticeRepositoryAsyncReference.EditAsync(Model); await EditCallback.InvokeAsync(true); } //IsShow = false; }
private long Create(long uid, string title, string content, bool isAsync, CreateCallback callback, Object state) { var parameterList = new Dictionary <string, string> { { "method", "facebook.notes.create" } }; Utilities.AddRequiredParameter(parameterList, "uid", uid); Utilities.AddRequiredParameter(parameterList, "title", title); Utilities.AddRequiredParameter(parameterList, "content", content); if (isAsync) { SendRequestAsync <notes_create_response, long>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <long>(callback), state); return(0); } var response = SendRequest <notes_create_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey)); return(response == null ? -1 : response.TypedValue); }
private void RunTests <TVTable>(int expectedMaxIndex, CreateCallback <TVTable> callback) where TVTable : struct, IVTable { for (int maxIndex = -1; maxIndex <= 20; ++maxIndex) { byte[] vtable = new byte[10 + (2 * maxIndex)]; BinaryPrimitives.WriteInt32LittleEndian(vtable, -4); BinaryPrimitives.WriteUInt16LittleEndian(vtable.AsSpan().Slice(4), (ushort)(vtable.Length - 4)); for (int i = 0; i <= maxIndex; ++i) { int start = 8 + (2 * i); BinaryPrimitives.WriteUInt16LittleEndian( vtable.AsSpan().Slice(start, 2), (ushort)i); } Test(vtable, expectedMaxIndex, maxIndex, callback); } }
private static void InitMultiplySlidersUIElement(CreateCallback createAction, OSCWindowControlCreator.ControlData data, MenuCommand menuCommand) { if (createAction == null) { return; } var resources = OSCEditorUtils.GetStandardResources(); resources.Color = data.ControlColor; var element = createAction(resources); if (data.UseInformer) { var multiplySliders = element.GetComponent <OSCMultiplySliders>(); multiplySliders.Address = data.InformAddress; multiplySliders.Transmitter = data.InformerTransmitter; } PlaceUIElement(element, menuCommand); }
protected async void CreateOrEditClick() { // 변경 내용 저장 ModelSender.Active = true; ModelSender.Name = ModelEdit.Name; ModelSender.CreatedBy = UserName ?? "Anonymous"; if (ModelSender.Id == 0) { // Create ModelSender.CreatedAt = DateTime.UtcNow; await RepositoryReference.AddAsync(ModelSender); CreateCallback?.Invoke(); } else { // Edit await RepositoryReference.UpdateAsync(ModelSender); await EditCallback.InvokeAsync(true); } }
protected async void CreateOrEditClick() { if (!int.TryParse(parentId, out int newParentId)) { newParentId = 0; } Model.ParentId = newParentId; if (Model.Id == 0) { // Create await UploadRepositoryAsyncReference.AddAsync(Model); CreateCallback?.Invoke(); // -> EditCallback } else { // Edit await UploadRepositoryAsyncReference.EditAsync(Model); await EditCallback.InvokeAsync(true); } //IsShow = false; }
/// <summary> /// 注册创建 TService Context Callback /// </summary> /// <param name="createCallback"></param> public void RegisterCallback(CreateCallback createCallback) { this.createCallback = createCallback; }
public static void CreateAsync <T>(CreateCallback <T> createCallback, T userData, String[] sources, Devices devices, String buildOptions) { CreateAsync <T>(createCallback, userData, sources, devices, Context.Default, buildOptions); }
public virtual void Initialize(CreateCallback callback) { // Object obj = Resources.Load (_warshipResourceName); // if (null == obj) // return; // // _thisGameObject = GameObject.Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject; // // Control the GameObject ourself // GameObject.DontDestroyOnLoad(_thisGameObject); // // if (_warshipName != null) // _thisGameObject.name = _warshipName; // Animation am = _thisGameObject.GetComponent<Animation>(); // if (am != null) // { // _mAnimationController = new AnimationController(am); // } // else // { // am = _thisGameObject.GetComponentInChildren<Animation>(); // if (am != null) // _mAnimationController = new AnimationController(am); // } // // _emitEffectFontUtil = _thisGameObject.AddComponent<EmitEffectFontUtil>(); // // AddPropertyComp(); // Create3DName(); // Show3DName(false); // // InitializeAttachmentSlots(); // // // Notify warship is created // OnWarshipCreated(); // // if (null != callback) // callback(this); // // IsLoaded = true; Globals.Instance.MResourceManager.Load(_warshipResourceName, delegate(Object obj, string error) { if (null == obj) { return; } _thisGameObject = GameObject.Instantiate(obj, Vector3.zero, Quaternion.identity) as GameObject; // Control the GameObject ourself GameObject.DontDestroyOnLoad(_thisGameObject); LayerMaskDefine.SetLayerRecursively(_thisGameObject, LayerMaskDefine.REFLECTION); if (_warshipName != null) { _thisGameObject.name = _warshipName; } Animation am = _thisGameObject.GetComponent <Animation>(); if (am != null) { _mAnimationController = new AnimationController(am); } else { am = _thisGameObject.GetComponentInChildren <Animation>(); if (am != null) { _mAnimationController = new AnimationController(am); } } _emitEffectFontUtil = _thisGameObject.AddComponent <EmitEffectFontUtil>(); AddPropertyComp(); Create3DName(); CreateWarshipHeader(); Show3DName(false); InitializeAttachmentSlots(); // Notify warship is created OnWarshipCreated(); if (null != callback) { callback(this); } IsLoaded = true; }); }
public static void CreateAsync <T>(CreateCallback <T> createCallback, T userData, String source, Devices devices, Context context, String buildOptions) { CreateAsync <T>(createCallback, userData, new String[] { source }, devices, context, buildOptions); }
public static void CreateAsync(CreateCallback createCallback, String[] sources, Devices devices, String buildOptions) { CreateAsync(createCallback, sources, devices, Context.Default, buildOptions); }
public static void CreateAsync(CreateCallback createCallback, String source, Devices devices, Context context, String buildOptions) { CreateAsync(createCallback, new String[] { source }, buildOptions); }
public AsyncHelperParameterless(Program program, CreateCallback createCallback) { this.CreateCallback = createCallback; }
/// <summary> /// Lets a user write a Facebook note through your application. /// See the facebook guide for more information. /// </summary> /// <example> /// <code> /// private static void RunDemoAsync() /// { /// Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey)); /// api.Notes.CreateAsync(Constants.UserId, "A test note", "My note content", AsyncDemoCompleted, null); /// } /// /// private static void AsyncDemoCompleted(long result, Object state, FacebookException e) /// { /// var actual = result; /// } /// </code> /// </example> /// <param name="uid">The user ID of the user posting the link.</param> /// <param name="title">The title of the note.</param> /// <param name="content">The note's content.</param> /// <param name="callback">The AsyncCallback delegate</param> /// <param name="state">An object containing state information for this asynchronous request</param> /// <returns>If successful, this method returns the note_id of the note that was just created.</returns> public void CreateAsync(long uid, string title, string content, CreateCallback callback, Object state) { Create(uid, title, content, true, callback, state); }