Exemplo n.º 1
0
        public async Task <FeedbackAPI> GetFeedback(int topicid)
        {
            FeedbackAPI f = new FeedbackAPI();

            // TODO - write!

            return(f);
        }
Exemplo n.º 2
0
        public static void Generate()
        {
            if (EditorUtility.DisplayDialog("Warning",
                                            "This operation will override existing configuration file. Do you want to continue?", "Ok", "Cancel"))
            {
                FeedbackAPI.CreateDefaultConfigurationFile(true);

                TextAsset configAsset = Resources.Load <TextAsset>(ConfigurationConstants.CONFIG_FILE_NAME);
                AssetDatabase.OpenAsset(configAsset, 0, 0);
            }
        }
Exemplo n.º 3
0
        public async Task Post([FromBody] FeedbackAPI body)
        {
            logger.LogInformation($"POST /api/feedback: incoming body = {body}");

            // call grain with payload
            string eventCode = body.Event;

            await ConnectClientIfNeeded();

            var grain = this.client.GetGrain <IEventGrain>(eventCode);
            await grain.SubmitFeedback(body.topic, body.rating, body.comment);

            return;
        }
Exemplo n.º 4
0
        public static void GenerateModel()
        {
            // TODO: check config first

            var window = (ModelGenerationProgress)EditorWindow.GetWindow(typeof(ModelGenerationProgress));

            var context = TaskScheduler.FromCurrentSynchronizationContext();
            var task    = FeedbackAPI.GetModelCreatorTask();

            task.ContinueWith(t => {
                window.EndMessage    = t.Result.ExitStatus == ExitStatus.ExitSuccess ? "Successfully generated model classes" : "Error occurred while generating";
                window.ProgressValue = t.Result.ExitStatus == ExitStatus.ExitSuccess ? 1f : 0f;
                AssetDatabase.Refresh();
            }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, context);

            task.ContinueWith(t =>
            {
                window.EndMessage = "Error occured";
                if (t.Exception == null)
                {
                    return;
                }
                foreach (var exception in t.Exception.InnerExceptions)
                {
                    window.AddError(exception.Message);
                }
            }, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, context);
            task.Start();

            window.titleContent = new GUIContent("Generating model classes");
            window.maxSize      = new Vector2(675f, 560f);
            window.minSize      = window.maxSize;

            FeedbackAPI.ModelCreatorOutput += (sender, e) => {
                if (e.OutputType == OutputType.StandardError)
                {
                    window.AddError(e.Data);
                }
                else
                {
                    window.AddMessage(e.Data);
                }
            };

            FeedbackAPI.ModelCreatorProgress += (sender, e) => window.ProgressValue = e.Progress;

            window.Show();
        }
Exemplo n.º 5
0
        public async Task Post([FromBody] FeedbackAPI body)
        {
            logger.LogInformation($"POST /api/feedback: incoming feedback for event {body.Event}, topic {body.topic}, comment {body.comment}");

            string eventid = body.Event;

            if (eventid == "")
            {
                Response.StatusCode = 400;
                return;
            }

            // call grain with payload

            await ConnectClientIfNeeded();

            var grain = this.client.GetGrain <IEventGrain>(eventid);
            int state;

            state = await grain.SubmitFeedback(body.topic, body.rating, body.comment);

            return;
        }
Exemplo n.º 6
0
        public static void Validate()
        {
            var result = FeedbackAPI.ValidateConfigurationFile();

            EditorUtility.DisplayDialog("Validation result", result.IsValid ? "Configuration is valid" : result.ErrorMessage, "Ok");
        }
Exemplo n.º 7
0
 // this method will be called on editor start
 static GenerateConfig()
 {
     FeedbackAPI.CreateDefaultConfigurationFile(false);
 }