Write() public method

public Write ( byte bytes ) : void
bytes byte
return void
コード例 #1
0
        private int OnSettings(HttpReqResp req)
        {
            try
            {
                var screenshotterCheck = (Database.GetInstanceSettings().WindowsContextTrackerEnabled ? "checked=\"checked\" " : "");
                var miniSurveysCheck   = (Database.GetInstanceSettings().MiniSurveysEnabled ? "checked=\"checked\"" : "");
                var idleCheck          = (Database.GetInstanceSettings().IdleEnabled ? "checked=\"checked\"" : "");
                var miniSurveyInterval = Database.GetInstanceSettings().MiniSurveyInterval;

                var html = "<form method=\"post\" action=\"setsettings\"><table border=\"0\" >" +
                           "<tr><td><label for=\"idle\">Mini-Surveys enabled</label>:</td><td><input type=\"checkbox\" name=\"miniSurveysCheck\" id=\"miniSurveysCheck\" " + miniSurveysCheck + "/></td><td></td></tr>" +
                           "<tr><td><label for=\"history\">Mini-Survey Interval</label>:</td><td><input type=\"text\" size=\"4\" type=\"number\" min=\"1\" maxlength=\"5\" name=\"miniSurveyInterval\" id=\"miniSurveyInterval\" value=\"" + miniSurveyInterval + "\" /></td><td>In minutes (e.g. '60', the tracker will ask you once an hour to fill out the mini-survey).</td></tr>" +
                           "<tr><td><label for=\"idle\">Windows Context Tracker enabled</label>:</td><td><input type=\"checkbox\" name=\"screenshotterCheck\" id=\"screenshotterCheck\" " + screenshotterCheck + "/></td><td>Hint: The tracker regularly takes screenshots that will later be automatically analyced using OCR techniques by the researchers.</td></tr>" +
                           "<tr><td><label for=\"idle\">IDLE enabled</label>:</td><td><input type=\"checkbox\" name=\"idleCheck\" id=\"idleCheck\" " + idleCheck + "/></td><td>Hint: Disable it when you regularly leave your PC on for hours without using it.</td></tr>" +
                           "<tr><td colspan='3'>&nbsp;</td></tr>" +
                           "<tr><td><input type=\"submit\" value=\"save\" /></td><td colspan='2' style=\"color: red;\">Hint: please restart the monitoring tool after enabling/disabling one of the trackers (via Task Manager).</td></tr>" +
                           "</table></form>";

                var title = Settings.SettingsTitle;

                html = ((string)_resourceManager.GetObject("personalanalytics_html"))
                       .Replace("{content}", html)
                       //.Replace("{menu}", Menu)
                       .Replace("{title}", title);
                req.Write(html);
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            catch (Exception e)
            {
                req.Write(e.ToString());
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            return(200);
        }
コード例 #2
0
        private int OnStats(HttpReqResp req)
        {
            try
            {
                var html = string.Empty;
                var date = VisHelper.GetVisualizationDateFromUrlParameters(req);
                //var visType = VisHelper.GetVisualizationTypesFromUrlParameters(req);

                // log request
                Database.GetInstance().LogInfo(string.Format("The participant opened the retrospection/visualization for '{0}'.", date));

                // prepare charts
                var contextTimelineChart = new ContextTimelineChart(date);
                var productivityGauge    = new ProductivityGaugeChart(date);
                var activityPie          = new ActivityPieChart(date);


                // organize & draw charts
                html += "<style type='text/css'>";
                html += "td { border: 3px solid #B0B0B0; }";
                html += "</style>";

                html += "<table cellpadding='20' style='margin-left: auto; margin-right: auto;'>"; // border-color: #F1F1F1;  vertical-align: top; horizontal-align: center;'
                html += "<tr><td style='vertical-align:top;'>" + productivityGauge.GetHtml() + "</td><td style='vertical-align:top;' rowspan='2'>" + contextTimelineChart.GetHtml() + "</td></tr>";
                html += "<tr><td style='vertical-align:top;'>" + activityPie.GetHtml() + "</td></tr>";
                html += "</table>";

                var title = Dict.RetrospectionPageTitle + " for the " + date.Date.ToShortDateString();
                if (RemoteDataHandler.VisualizeWithRemoteData())
                {
                    title += " (visualizing local and remote data)";
                }
                //title += "<a href=\"settings\">" + Settings.SettingsTitle + "</a>";

                html = ((string)_resourceManager.GetObject("personalanalytics_html"))
                       .Replace("{content}", html)
                       //.Replace("{menu}", Menu)
                       .Replace("{title}", title);
                req.Write(html);
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            catch (Exception e)
            {
                req.Write(e.ToString());
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            return(200);
        }
コード例 #3
0
 private int OnStylesheets(HttpReqResp req)
 {
     try
     {
         req.Write((byte[])_resourceManager.GetObject(req.Script.Replace('.', '_')));
         req.SetHeader("Content-Type", req.Script.EndsWith(".png") ? "image/png" : "text/css");
     }
     catch { }
     return(200);
 }
コード例 #4
0
 private int OnResource(HttpReqResp req)
 {
     try
     {
         req.Write((byte[])_resourceManager.GetObject(req.Script.Replace('.', '_')));
         req.SetHeader("Content-Type", req.Script.EndsWith(".png") ? "image/png" : "text/javascript");
     }
     catch { }
     return 200;
 }
コード例 #5
0
        private int OnStats(HttpReqResp req)
        {
            try
            {
                var html = string.Empty;
                var date = VisHelper.GetVisualizationDateFromUrlParameters(req);
                //var visType = VisHelper.GetVisualizationTypesFromUrlParameters(req);

                // log request
                Database.GetInstance().LogInfo(string.Format("The participant opened the retrospection/visualization for '{0}'.", date));

                // prepare charts
                var contextTimelineChart = new ContextTimelineChart(date);
                var productivityGauge = new ProductivityGaugeChart(date);
                var activityPie = new ActivityPieChart(date);

                // organize & draw charts
                html += "<style type='text/css'>";
                html += "td { border: 3px solid #B0B0B0; }";
                html += "</style>";

                html += "<table cellpadding='20' style='margin-left: auto; margin-right: auto;'>"; // border-color: #F1F1F1;  vertical-align: top; horizontal-align: center;'
                html += "<tr><td style='vertical-align:top;'>" + productivityGauge.GetHtml() + "</td><td style='vertical-align:top;' rowspan='2'>" + contextTimelineChart.GetHtml() + "</td></tr>";
                html += "<tr><td style='vertical-align:top;'>" + activityPie.GetHtml() + "</td></tr>";
                html += "</table>";

                var title = Dict.RetrospectionPageTitle + " for the " + date.Date.ToShortDateString();
                if (RemoteDataHandler.VisualizeWithRemoteData()) title += " (visualizing local and remote data)";
                //title += "<a href=\"settings\">" + Settings.SettingsTitle + "</a>";

                html = ((string) _resourceManager.GetObject("personalanalytics_html"))
                    .Replace("{content}", html)
                    //.Replace("{menu}", Menu)
                    .Replace("{title}", title);
                req.Write(html);
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            catch (Exception e)
            {
                req.Write(e.ToString());
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            return 200;
        }
コード例 #6
0
        private int OnSettings(HttpReqResp req)
        {
            try
            {
                var screenshotterCheck = (Database.GetInstanceSettings().WindowsContextTrackerEnabled ? "checked=\"checked\" " : "");
                var miniSurveysCheck = (Database.GetInstanceSettings().MiniSurveysEnabled ? "checked=\"checked\"" : "");
                var idleCheck = (Database.GetInstanceSettings().IdleEnabled ? "checked=\"checked\"" : "");
                var miniSurveyInterval = Database.GetInstanceSettings().MiniSurveyInterval;

                var html = "<form method=\"post\" action=\"setsettings\"><table border=\"0\" >" +
                    "<tr><td><label for=\"idle\">Mini-Surveys enabled</label>:</td><td><input type=\"checkbox\" name=\"miniSurveysCheck\" id=\"miniSurveysCheck\" " + miniSurveysCheck + "/></td><td></td></tr>" +
                    "<tr><td><label for=\"history\">Mini-Survey Interval</label>:</td><td><input type=\"text\" size=\"4\" type=\"number\" min=\"1\" maxlength=\"5\" name=\"miniSurveyInterval\" id=\"miniSurveyInterval\" value=\"" + miniSurveyInterval + "\" /></td><td>In minutes (e.g. '60', the tracker will ask you once an hour to fill out the mini-survey).</td></tr>" +
                    "<tr><td><label for=\"idle\">Windows Context Tracker enabled</label>:</td><td><input type=\"checkbox\" name=\"screenshotterCheck\" id=\"screenshotterCheck\" " + screenshotterCheck + "/></td><td>Hint: The tracker regularly takes screenshots that will later be automatically analyced using OCR techniques by the researchers.</td></tr>" +
                    "<tr><td><label for=\"idle\">IDLE enabled</label>:</td><td><input type=\"checkbox\" name=\"idleCheck\" id=\"idleCheck\" " + idleCheck + "/></td><td>Hint: Disable it when you regularly leave your PC on for hours without using it.</td></tr>" +
                    "<tr><td colspan='3'>&nbsp;</td></tr>" +
                    "<tr><td><input type=\"submit\" value=\"save\" /></td><td colspan='2' style=\"color: red;\">Hint: please restart the monitoring tool after enabling/disabling one of the trackers (via Task Manager).</td></tr>" +
                    "</table></form>";

                var title = Settings.SettingsTitle;

                html = ((string)_resourceManager.GetObject("personalanalytics_html"))
                    .Replace("{content}", html)
                    //.Replace("{menu}", Menu)
                    .Replace("{title}", title);
                req.Write(html);
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            catch (Exception e)
            {
                req.Write(e.ToString());
                req.SetHeader("Content-Type", "text/html; charset=utf-8");
            }
            return 200;
        }