internal GeneratorInfo(EditCallback <AdditionalFileEdit>?editCallback, SyntaxContextReceiverCreator?receiverCreator, Action <GeneratorPostInitializationContext>?postInitCallback)
 {
     EditCallback = editCallback;
     SyntaxContextReceiverCreator = receiverCreator;
     PostInitCallback             = postInitCallback;
     Initialized = true;
 }
Example #2
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()
        }
Example #3
0
 public void StartEdit(EditCallback callback)
 {
     if (IsEditing)
     {
         return;
     }
     EditingName   = Name;
     mEditCallback = callback;
     OnPropertyChanged("IsEditing");
 }
Example #4
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;
        }
Example #5
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;
        }
Example #6
0
        private bool Edit(long note_id, string title, string content, bool isAsync, EditCallback callback, Object state)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.notes.edit" }
            };

            Utilities.AddRequiredParameter(parameterList, "note_id", note_id);
            Utilities.AddRequiredParameter(parameterList, "title", title);
            Utilities.AddRequiredParameter(parameterList, "content", content);

            if (isAsync)
            {
                SendRequestAsync <notes_edit_response, bool>(parameterList, !string.IsNullOrEmpty(Session.SessionKey), new FacebookCallCompleted <bool>(callback), state);
                return(true);
            }

            var response = SendRequest <notes_edit_response>(parameterList, !string.IsNullOrEmpty(Session.SessionKey));

            return(response == null ? false : response.TypedValue);
        }
Example #7
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);
            }
        }
Example #8
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;
        }
Example #9
0
 internal void RegisterForAdditionalFileChanges(EditCallback <AdditionalFileEdit> callback)
 {
     CheckIsEmpty(InfoBuilder.EditCallback);
     InfoBuilder.EditCallback = callback;
 }
Example #10
0
 /// <summary>
 /// Lets a user edit a Facebook note through your application.
 /// </summary>
 /// <example>
 /// <code>
 /// private static void RunDemoAsync()
 /// {
 ///     Api api = new Api(new DesktopSession(Constants.ApplicationKey, Constants.ApplicationSecret, Constants.ApplicationSecret, Constants.SessionKey));
 ///     api.Notes.EditAsync(Constants.NoteId, "An Async test note (Updated)", "My Async note content has also been updated!", AsyncDemoCompleted, null);
 /// }
 ///
 /// private static void AsyncDemoCompleted(bool result, Object state, FacebookException e)
 /// {
 ///     var actual = result;
 /// }
 /// </code>
 /// </example>
 /// <param name="note_id">The ID of the note to edit.</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>This method returns true if successful.</returns>
 public void EditAsync(long note_id, string title, string content, EditCallback callback, Object state)
 {
     Edit(note_id, title, content, true, callback, state);
 }
Example #11
0
 internal GeneratorInfo(EditCallback <AdditionalFileEdit>?editCallback, SyntaxReceiverCreator?receiverCreator)
 {
     EditCallback          = editCallback;
     SyntaxReceiverCreator = receiverCreator;
     Initialized           = true;
 }
Example #12
0
 public void SetOnEditCallback(EditCallback onEditCallback)
 {
     OnEditCallback = onEditCallback;
 }