Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
    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));
    }
Exemplo n.º 3
0
 public void CreateAssetBundleBuild(CreateCallback createCallback)
 {
     createCallback(new AssetBundleBuild()
     {
         assetBundleName = AssetBundleName,
         assetNames      = AssetNames,
     });
 }
Exemplo n.º 4
0
        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()
        }
Exemplo n.º 5
0
        public void CreateAssetBundleBuild(CreateCallback createCallback)
        {
            string path = AssetDatabase.GetAssetPath(AssetFolder);

            createCallback(new AssetBundleBuild()
            {
                assetBundleName = BuildRuleUtil.PathToAssetBundleName(path),
                assetNames      = new string[] { path },
            });
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 8
0
    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;
        });
    }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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));
        }
Exemplo n.º 11
0
        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] },
                });
            }
        }
Exemplo n.º 12
0
        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;
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
    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);
        }
    }
Exemplo n.º 15
0
        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);
        }
Exemplo n.º 16
0
        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);
            }
        }
Exemplo n.º 17
0
        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;
        }
Exemplo n.º 18
0
 /// <summary>
 /// 注册创建 TService Context Callback
 /// </summary>
 /// <param name="createCallback"></param>
 public void RegisterCallback(CreateCallback createCallback)
 {
     this.createCallback = createCallback;
 }
Exemplo n.º 19
0
 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);
 }
Exemplo n.º 20
0
    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;
        });
    }
Exemplo n.º 21
0
 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);
 }
Exemplo n.º 22
0
 public static void CreateAsync(CreateCallback createCallback, String[] sources, Devices devices, String buildOptions)
 {
     CreateAsync(createCallback, sources, devices, Context.Default, buildOptions);
 }
Exemplo n.º 23
0
 public static void CreateAsync(CreateCallback createCallback, String source, Devices devices, Context context, String buildOptions)
 {
     CreateAsync(createCallback, new String[] { source }, buildOptions);
 }
Exemplo n.º 24
0
 public AsyncHelperParameterless(Program program, CreateCallback createCallback)
 {
     this.CreateCallback = createCallback;
 }
Exemplo n.º 25
0
 /// <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);
 }