static void Internal_PauseStateChanged(PauseState state) { #pragma warning disable 618 playmodeStateChanged?.Invoke(); #pragma warning restore 618 pauseStateChanged?.Invoke(state); }
static void Internal_CallUpdateFunctions() { if (update != null) { if (Profiler.enabled && !ProfilerDriver.deepProfiling) { var currentUpdateHash = update.GetHashCode(); if (currentUpdateHash != m_UpdateHash) { m_UpdateInvocationList = update.GetInvocationList(); m_UpdateHash = currentUpdateHash; } foreach (var cb in m_UpdateInvocationList) { var marker = new ProfilerMarker(cb.Method.Name); marker.Begin(); cb.DynamicInvoke(null); marker.End(); } } else { update.Invoke(); } } }
private async void Initializer(CallbackFunction callbackFun) { RequestHelper requestHelper = new RequestHelper(); pageIndex++; var requestURL = ConfigurationArgument.RequestURLMainPage.Replace("{pageIndex}", pageIndex.ToString()).Replace("{pageSize}", PAGESIZE); if (BlogListDataContent == null) { BlogListDataContent = new ObservableCollection <Blogger>(); } var responseString = await requestHelper.HttpGet(requestURL); var entries = XmlHelper.GetFeed <Feed <Blogger> >(responseString).Entries; foreach (var entry in entries) { this.BlogListDataContent.Add(entry); } if (callbackFun != null) { callbackFun.Invoke(); } }
static void Internal_CallDelayFunctions() { CallbackFunction delay = delayCall; delayCall = null; delay?.Invoke(); }
public void Load(string collectionName, CallbackFunction.Load<IList<JsonDocument>> callback) { Guard.Assert(() => !string.IsNullOrEmpty(collectionName)); Guard.Assert(() => callback != null); SynchronizationContext context = SynchronizationContext.Current; IndexSession.Query("Raven/DocumentsByEntityName", new IndexQuery {Query = string.Format("Tag:{0}", collectionName)}, null, (result) => { var documents = new List<JsonDocument>(); if (result.IsSuccess) { var jsonSerializer = new JsonSerializer(); documents = result.Data.Results.Select( document => (JsonDocument) jsonSerializer.Deserialize(document.CreateReader(), typeof (JsonDocument))). ToList(); } var loadResponse = new LoadResponse<IList<JsonDocument>> { Data = documents, Exception = result.Exception, StatusCode = result.StatusCode }; context.Post(delegate { callback.Invoke(loadResponse); }, null); }); }
static void Internal_CallHierarchyHasChanged() { #pragma warning disable 618 hierarchyWindowChanged?.Invoke(); #pragma warning restore 618 hierarchyChanged?.Invoke(); }
static void Internal_CallProjectHasChanged() { #pragma warning disable 618 projectWindowChanged?.Invoke(); #pragma warning restore 618 projectChanged?.Invoke(); }
static void Internal_CallGlobalEventHandler() { globalEventHandler?.Invoke(); // Ensure this is called last in order to make sure no null current events are passed to other handlers WindowLayout.MaximizeGestureHandler(); Event.current = null; }
public ErrorMessage(string errorText, CallbackFunction callback) { MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult result = MessageBox.Show(errorText, "Error", buttons, MessageBoxIcon.Error); if (result == System.Windows.Forms.DialogResult.OK) { callback?.Invoke(); } }
public void LoadPlugins(CallbackFunction.Load<IList<KeyValuePair<string, Attachment>>> callback) { var context = SynchronizationContext.Current; Client.AttachmentGetAll((result) => context.Post(delegate { callback.Invoke(new LoadResponse<IList<KeyValuePair<string, Attachment>>>() { Data = result.Data.Where(x => x.Key.EndsWith(".xap", StringComparison.InvariantCultureIgnoreCase)).ToList(), Exception = result.Exception, StatusCode = result.StatusCode }); } , null)); }
public void HookCallback( Action <TInstance> originalFunction, TInstance instance) { var parameters = MocksaneParameters.Create(); if (Instance != instance) { originalFunction(instance); return; } if (PredicateFunction != null && !PredicateFunction(parameters)) { originalFunction(instance); return; } CallCount++; CallbackFunction?.Invoke(parameters); }
internal static void Internal_CallAssetBundleNameChanged() { assetBundleNameChanged?.Invoke(); }
internal static void Internal_CallAssetLabelsHaveChanged() { assetLabelsChanged?.Invoke(); }
internal static void Internal_CallSearchHasChanged() { searchChanged?.Invoke(); }
private void IndexGet_Callback(string name, HttpJsonRequest request, IAsyncResult result, CallbackFunction.Load<KeyValuePair<string, IndexDefinition>> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); var index = new KeyValuePair<string, IndexDefinition>(); if (exception == null) { index = IndexMapper.Map(json); } var loadResponse = new LoadResponse<KeyValuePair<string, IndexDefinition>> { Data = index, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(loadResponse); }, null); }
private void IndexGetAll_Callback(IDictionary<string, IndexDefinition> existingEntities, HttpJsonRequest request, IAsyncResult result, CallbackFunction.Load<IDictionary<string, IndexDefinition>> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); JArray array = JArray.Parse(json); var responseResult = new Dictionary<string, IndexDefinition>(); if (exception == null) { var entities = array.Select(index => IndexMapper.Map(index.ToString())); responseResult = responseResult.Concat(entities).ToDictionary(x => x.Key, y => y.Value); if (existingEntities != null) { responseResult.Concat(existingEntities); } } var loadResponse = new LoadResponse<IDictionary<string, IndexDefinition>> { Data = responseResult, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(loadResponse); }, null); }
private void AttachmentDelete_Callback(string key, HttpJsonRequest request, IAsyncResult result, CallbackFunction.SaveMany<string> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); var deleteResponse = new DeleteResponse<string> { Data = key, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(new List<Response<string>> { deleteResponse }); }, null); }
static void Internal_CallWindowsReordered() { windowsReordered?.Invoke(); }
private void DocumentBatch_Callback(IList<ICommandData> batchCommands, HttpJsonRequest request, IAsyncResult result, CallbackFunction.Batch batchCallback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); var batchResults = JsonConvert.DeserializeObject<BatchResult[]>(json); context.Post( delegate { batchCallback.Invoke(batchResults.ToList()); }, null); }
private void AttachmentGet_Callback(string key, HttpJsonRequest request, IAsyncResult result, CallbackFunction.Load<KeyValuePair<string, Attachment>> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; Attachment attachment = AttachmentMapper.Map(key, request.HttpWebRequest, result, out statusCode, out exception); var loadResponse = new LoadResponse<KeyValuePair<string, Attachment>> { Data = new KeyValuePair<string, Attachment>(key, attachment), StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(loadResponse); }, null); }
private void StatisticsGet_Callback(HttpJsonRequest request, IAsyncResult result, CallbackFunction.Load<DatabaseStatistics> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); var statistics = this.StatisticsMapper.Map(json); var loadResponse = new LoadResponse<DatabaseStatistics>() { Data = statistics, Exception = exception, StatusCode = statusCode }; context.Post(delegate { callback.Invoke(loadResponse); }, null); }
private void AttachmentPut_Callback(string key, Guid? etag, byte[] data, JObject metadata, HttpJsonRequest request, IAsyncResult result, CallbackFunction.SaveMany<Attachment> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); var saveResponse = new SaveResponse<Attachment> { Data = new Attachment { Data = data, Metadata = metadata }, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(new List<Response<Attachment>> { saveResponse }); }, null); }
private void DocumentGetAll_Callback(HttpJsonRequest request, IAsyncResult result, CallbackFunction.Load<IList<JsonDocument>> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); JArray array = JArray.Parse(json); var responseResult = new List<JsonDocument>(); if (exception == null) { responseResult = array.Select(jsonDocument => DocumentMapper.Map(jsonDocument.ToString())).ToList(); } var loadResponse = new LoadResponse<IList<JsonDocument>> { Data = responseResult, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(loadResponse); }, null); }
public static void DirtyHierarchyWindowSorting() { dirtyHierarchySorting?.Invoke(); }
static void Internal_CallKeyboardModifiersChanged() { modifierKeysChanged?.Invoke(); }
private void IndexSave_Callback(string name, IndexDefinition entity, HttpJsonRequest request, IAsyncResult result, CallbackFunction.SaveOne<KeyValuePair<string, IndexDefinition>> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); var saveResponse = new SaveResponse<KeyValuePair<string, IndexDefinition>> { Data = new KeyValuePair<string, IndexDefinition>(name, entity), StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(saveResponse); }, null); }
private void DocumentGet_Callback(string key, HttpJsonRequest request, IAsyncResult result, CallbackFunction.Load<JsonDocument> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); JsonDocument document = null; if (exception == null) { document = DocumentMapper.Map(json); document.Metadata = headers.FilterHeaders(isServerDocument: false); document.Key = key; } var loadResponse = new LoadResponse<JsonDocument> { Data = document, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(loadResponse); }, null); }
private void AttachmentGetAll_Callback(HttpJsonRequest request, IAsyncResult result, CallbackFunction.Load<IList<KeyValuePair<string, Attachment>>> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); JArray array = JArray.Parse(json); var attachments = new List<KeyValuePair<string, Attachment>>(); string key; foreach (JToken attachment in array) { attachments.Add(AttachmentMapper.Map(attachment)); } var loadResponse = new LoadResponse<IList<KeyValuePair<string, Attachment>>> { Data = attachments, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(loadResponse); }, null); }
// Can be used to ensure repaint of the HierarchyWindow. public static void RepaintHierarchyWindow() { refreshHierarchy?.Invoke(); }
private void DocumentSave_Callback(JsonDocument document, HttpJsonRequest request, IAsyncResult result, CallbackFunction.SaveMany<JsonDocument> callback) { SynchronizationContext context = GetContext(request); DeleteContext(request); HttpStatusCode statusCode; Exception exception; NameValueCollection headers; string json = GetResponseStream(request.HttpWebRequest, result, out statusCode, out exception, out headers); if (exception == null) { JObject responseJson = JObject.Parse(json); document.Etag = new Guid(responseJson["ETag"].ToString().Replace("\"", string.Empty)); document.Key = responseJson["Key"].ToString().Replace("\"", string.Empty); } var saveResponse = new SaveResponse<JsonDocument> { Data = document, StatusCode = statusCode, Exception = exception }; context.Post( delegate { callback.Invoke(new List<Response<JsonDocument>> { saveResponse }); }, null); }