Exemple #1
0
        //It seems very controller has a binding that cannot be changed. So now we make a new binding. See case 2 in the primary controller
        public ActionResult EmptyDataSet(int r, int c)
        {
            ViewInput newVI = new ViewInput();

            newVI.createEmptyInput(r, c);
            return(View("~/Views/Home/DecisionTree.cshtml", newVI));
        }
Exemple #2
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            Camera   = Camera ?? GetViewport().GetCamera();
            Distance = InitialDistance;

            OnActiveStateChange
            .Do(v => _viewInput.Active = v)
            .Do(v => _zoomInput.Active = v)
            .Subscribe()
            .AddTo(this);

            ViewInput
            .Select(v => v * 0.05f)
            .Subscribe(v => Rotation -= v)
            .AddTo(this);

            ZoomInput
            .Subscribe(v => Distance -= v * 0.05f)
            .AddTo(this);

            OnActiveStateChange
            .Where(v => v)
            .Skip(Active ? 1 : 0)
            .Subscribe(_ => Distance = DistanceRange.Min + 0.1f)
            .AddTo(this);
        }
Exemple #3
0
        //It seems very controller has a binding that cannot be changed. So now we make a new binding. See case 2 in the primary controller
        public ActionResult ExampleDataSet()
        {
            ViewInput newVI = new ViewInput();

            newVI.exampleDataSet();
            return(View("~/Views/Home/DecisionTree.cshtml", newVI));
        }
        private string GenerateHtml(ViewInput viewInput)
        {
            bool   isDevelopment;
            string developmentHost;
            string productionHost;

            if (viewInput.IsCore)
            {
                isDevelopment   = _frontendSettings.CoreEnvironment.IsDevelopment;
                developmentHost = _frontendSettings.CoreEnvironment.DevelopmentHost;
                productionHost  = _frontendSettings.CoreEnvironment.ProductionHost;
            }
            else
            {
                isDevelopment   = _frontendSettings.ProjectEnvironment.IsDevelopment;
                developmentHost = _frontendSettings.ProjectEnvironment.DevelopmentHost;
                productionHost  = _frontendSettings.ProjectEnvironment.ProductionHost;
            }

            var componentScripts = new StringBuilder();

            if (!viewInput.Components.IsNullOrWhiteSpace())
            {
                var components = viewInput.Components.Split(',', ';');
                foreach (var compent in components)
                {
                    switch (compent.ToLower())
                    {
                    case "ckfinder":
                        // ckfinder 需要获取语言包,涉及跨域,故总是从服务器取脚本
                        componentScripts.AppendFormat("<script type = \"text/javascript\" src=\"{0}/ckfinderscripts/ckfinder.js\"></script>", productionHost);
                        break;

                    case "signalr":
                        componentScripts.AppendFormat("<script type = \"text/javascript\" src=\"{0}/lib/signalr/dist/browser/signalr.js\"></script>", productionHost);
                        break;

                    default:
                        throw new NotImplementedException(compent);
                    }
                }
            }

            // 模板有4种
            string template;

            if (viewInput.IsCore)
            {
                template = isDevelopment ? DevelopmentCoreTemplate : ProductionCoreTemplate;
            }
            else
            {
                template = isDevelopment ? DevelopmentTemplate : ProductionTemplate;
            }

            var html = String.Format(template, viewInput.Title, isDevelopment ? developmentHost : productionHost, viewInput.Name, componentScripts);

            return(html);
        }
Exemple #5
0
        public ActionResult ProvideInputConditions(ViewInput vi)
        {
            vi.inputConditionsSelected = true;
            var rs = vi.rows.ToString();
            var cs = vi.columns.ToString();

            return(RedirectToAction("DecisionTree", new { r = rs, c = cs }));//These variable names must match the names of parameters in DecisionTree
        }
        private void InitializeSetupUtils()
        {
            var actionsGraph = SetupUtils.ActionGraph;
            var viewInput    = new ViewInput(View, Viewer, Form);

            actionsGraph.RemoveInput(InputNames.View);
            actionsGraph.Register(viewInput);
        }
Exemple #7
0
 public async Task CreateOrUpdateView(ViewInput input)
 {
     if (input.Id > 0)
     {
         await UpdateView(input);
     }
     else
     {
         await CreateView(input);
     }
 }
Exemple #8
0
        //======================================
        //The following controllers are not used
        //======================================

        public ActionResult DecisionTree(String r, String c)
        {
            ViewBag.Message = "How to manage a decision tree";
            ViewInput vi = new ViewInput();

            if (!String.IsNullOrEmpty(r) && !String.IsNullOrEmpty(c))
            {
                vi.columns = Int32.Parse(c);
                vi.rows    = Int32.Parse(r);
                vi.createEmptyInput(Int16.Parse(r), Int16.Parse(c));
            }
            var test = vi.cells.Count().ToString();

            return(View(vi));
        }
Exemple #9
0
        public ActionResult GenerateDecisionTree(ViewInput vi, String command)
        {
            switch (command)
            {
            case "submit1":
                //vi.emptyCells();
                //ViewBag.Message = "How to manage a decision tree";
                //vi.createEmptyInput(vi.rows, vi.columns);
                return(RedirectToAction("EmptyDataSet", new { r = vi.rows, c = vi.columns }));

                break;

            case "submit2":
                //vi.exampleDataSet();
                return(RedirectToAction("ExampleDataSet"));

                break;

            case "submit4":
                Dictionary <String, String> conditionsList = new Dictionary <String, String>();
                for (int j = 0; j < vi.cells[0].Count - 1; j++)
                {
                    conditionsList.Add(vi.cells[0][j], vi.conditions[j]);
                }
                DataSet          ds  = new DataSet(vi.cells);
                DecisionTreeNode dtn = new DecisionTreeNode(ds);
                dtn.recursivelyConstructDecisionTreeLevels(dtn);
                vi.result = dtn.determineResult(dtn, conditionsList);
                goto case "submit3";

            case "submit3":
                vi.inputConditionsSelected = true;
                int i = vi.cells[0].Count();
                while (i > 1)
                {
                    vi.conditions.Add("");
                    i--;
                }
                break;

            default:
                break;
            }
            return(View("~/Views/Home/DecisionTree.cshtml", vi));
            //return View("~/Views/Home/DecisionTree.cshtml", vi);
        }
Exemple #10
0
        public async Task UpdateView(ViewInput input)
        {
            var val = _viewRepository
                      .GetAll().Where(p => p.Name == input.Name && p.Id != input.Id).FirstOrDefault();

            if (val == null)
            {
                var viw = await _viewRepository.GetAsync(input.Id);

                ObjectMapper.Map(input, viw);
                await _viewRepository.UpdateAsync(viw);
            }
            else
            {
                throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in Name '" + input.Name + "' ...");
            }
        }
        public void SetUp()
        {
            new FileSystem().DeleteDirectory("MyLib");
            new FileSystem().CreateDirectory("MyLib");
            theLocation = new Location
            {
                Namespace    = "MyLib.A.B",
                Project      = CsProjFile.CreateAtSolutionDirectory("MyLib", "MyLib"),
                RelativePath = "A/B"
            };

            theViewInput = new ViewInput
            {
                Name    = "MyModel",
                UrlFlag = "foo/bar/model"
            };

            theFile = ViewModelBuilder.BuildCodeFile(theViewInput, theLocation);
        }
Exemple #12
0
        public override ControllerRequest View(object model)
        {
            ViewInput input = (ViewInput)model;

            Console.Clear();
            Console.CursorVisible = false;

            IPerson currentUser = ApplicationData.CurrentData.CurrentPerson;

            FieldList fields = new FieldList();

            int left = 3;
            int top  = 2;

            ViewTools.Txt(top: top++, left: left, text: "Добавление нового сотрудника");
            ViewTools.Txt(top: top++, left: left, text: $"Пользователь: {currentUser.FirstName}, {currentUser.LastName}");
            ViewTools.Txt(top: top++, left: left, text: "--------------------------------------------");
            top++;
            ViewTools.Txt(top: top, left: left, text: "Имя            :");
            fields.Add(new EditField(top: top++, left: left + 16, length: 15, name: "FirstName", text: input?.Values["FirstName"] ?? ""));

            ViewTools.Txt(top: top, left: left, text: "Фамилия        :");
            fields.Add(new EditField(top: top++, left: left + 16, length: 15, name: "LastName", text: input?.Values["LastName"] ?? ""));

            ViewTools.Txt(top: top, left: left, text: "Роль (1, 2, 3) :");
            fields.Add(new EditField(top: top++, left: left + 16, length: 1, name: "Role", text: input?.Values["Role"] ?? ""));

            top++;
            fields.Add(new WaitOkField(top: top++, left: left, name: "Ok", text: "[ Ok ]"));

            if (!string.IsNullOrWhiteSpace(input?.Message))
            {
                top++;
                Console.ForegroundColor = ConsoleColor.Red;
                ViewTools.Txt(top: top++, left: left, text: input.Message);
                Console.ResetColor();
            }

            var viewStatus = fields.Input();

            return(new ControllerRequest <ManagerAddNewPersonController>(viewStatus, fields.ToResultValueList()));
        }
        public void viewInput()
        {
            ViewInput vi = new ViewInput();

            vi.createEmptyInput(5, 5);
            Assert.AreEqual(vi.cells.Count(), 5);
            Assert.AreEqual(vi.cells[0].Count(), 5);
            Assert.AreEqual(vi.cells[1].Count(), 5);
            Assert.AreEqual(vi.cells[2].Count(), 5);
            Assert.AreEqual(vi.cells[3].Count(), 5);
            Assert.AreEqual(vi.cells[4].Count(), 5);

            Assert.AreEqual(vi.cells[0][0], "");
            Assert.AreEqual(vi.cells[0][2], "");
            Assert.AreEqual(vi.cells[1][3], "");
            Assert.AreEqual(vi.cells[0][0], "");
            Assert.AreEqual(vi.cells[0][0], "");
            Assert.AreEqual(vi.cells[4][1], "");
            Assert.AreEqual(vi.cells[4][0], "");
        }
Exemple #14
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            Camera = Camera ?? GetViewport().GetCamera();

            ViewInput
            .Select(v => v * 0.05f)
            .Subscribe(v => Rotation -= v)
            .AddTo(this);

            ZoomInput
            .Subscribe(v => Distance -= v * 0.05f)
            .AddTo(this);

            OnActiveStateChange
            .Where(v => v)
            .Subscribe(_ => Distance = InitialDistance)
            .AddTo(this);
        }
Exemple #15
0
    public void ExecuteUpdate(ViewInput viewInput)
    {
        Look(viewInput.lookInput);

        interactTestTimer += Time.deltaTime;
        if (interactTestTimer > interactTestInterval)
        {
            UpdateInteractInfo();
        }
        interactTestTimer = interactTestTimer % interactTestInterval;

        if (viewInput.fireInput)
        {
            Cursor.lockState = CursorLockMode.Locked;
            if (grabbedRB != null)
            {
                DropObject(ref grabbedRB, grabbedRBSettings, true);
                //TODO unholster
            }
        }
        if (viewInput.interactInput)
        {
            if (grabbedRB != null)
            {
                DropObject(ref grabbedRB, grabbedRBSettings, false);
                //TODO unholster
            }
            else
            {
                bool successfullyInteracted;
                TryToInteract(out successfullyInteracted);
                if (!successfullyInteracted)
                {
                    //TODO error sound
                }
            }
        }
    }
Exemple #16
0
        public override ControllerRequest View(object model)
        {
            ViewInput input = (ViewInput)model;

            Console.Clear();
            Console.CursorVisible = false;

            FieldList fields = new FieldList();

            int left = 3;
            int top  = 2;

            ViewTools.Txt(top: top++, left: left, text: "Добро пожаловать, представьтесь пожалуйста");
            ViewTools.Txt(top: top++, left: left, text: "--------------------------------------------");

            ViewTools.Txt(top: top, left: left, text: "Имя     :");
            fields.Add(new EditField(top: top++, left: left + 10, length: 15, name: "FirstName", text: ""));

            ViewTools.Txt(top: top, left: left, text: "Фамилия :");
            fields.Add(new EditField(top: top++, left: left + 10, length: 15, name: "LastName", text: ""));

            top++;
            fields.Add(new WaitOkField(top: top++, left: left, name: "Ok", text: "[ Ok ]"));

            if (!string.IsNullOrWhiteSpace(input?.Message))
            {
                top++;
                Console.ForegroundColor = ConsoleColor.Red;
                ViewTools.Txt(top: top++, left: 3, length: 30, text: input.Message);
                Console.ResetColor();
            }

            eViewStatus viewStatus = fields.Input();

            return(new ControllerRequest <LoginController>(viewStatus: viewStatus, valueList: fields.ToResultValueList()));
        }
Exemple #17
0
        public void SetUp()
        {
            var theOriginalLocation = Environment.CurrentDirectory;

            var project = CsProjFile.CreateAtSolutionDirectory("MyProject", "MyProject");

            project.Save();

            var projectPath = project.FileName.ToFullPath();

            var projectFolder = project.FileName.ParentDirectory();

            theCurrentDirectory = projectFolder.AppendPath("Suite", "Tools").ToFullPath();

            new FileSystem().CreateDirectory(theCurrentDirectory);
            Environment.CurrentDirectory = theCurrentDirectory;


            var input = new ViewInput
            {
                Name         = "MyView",
                TemplateFlag = "view.spark",
                UrlFlag      = "foo/bar"
            };

            try
            {
                MvcBuilder.BuildView(input);

                theProject = CsProjFile.LoadFrom(projectPath);
            }
            finally
            {
                Environment.CurrentDirectory = theOriginalLocation;
            }
        }
Exemple #18
0
        public async Task CreateView(ViewInput input)
        {
            try
            {
                var value = _viewRepository
                            .GetAll().Where(p => p.Id == input.Id).FirstOrDefault();

                input.Id = 0;

                var Data = input.MapTo <View>();
                if (string.IsNullOrEmpty(input.Salesman) == true)
                {
                    if (string.IsNullOrEmpty(value.Salesman) == false)
                    {
                        Data.Salesman = value.Salesman;
                    }
                }
                if (string.IsNullOrEmpty(input.Designer) == true)
                {
                    if (string.IsNullOrEmpty(value.Designer) == false)
                    {
                        Data.Designer = value.Designer;
                    }
                }
                if (string.IsNullOrEmpty(input.Coordinator) == true)
                {
                    if (string.IsNullOrEmpty(value.Coordinator) == false)
                    {
                        Data.Coordinator = value.Coordinator;
                    }
                }
                if (string.IsNullOrEmpty(input.Probability) == true)
                {
                    if (string.IsNullOrEmpty(value.Probability) == false)
                    {
                        Data.Probability = value.Probability;
                    }
                }
                if (string.IsNullOrEmpty(input.Probability) == true)
                {
                    if (string.IsNullOrEmpty(value.Probability) == false)
                    {
                        Data.Probability = value.Probability;
                    }
                }
                if (string.IsNullOrEmpty(input.StatusForQuotation) == true)
                {
                    if (string.IsNullOrEmpty(value.StatusForQuotation) == false)
                    {
                        Data.StatusForQuotation = value.StatusForQuotation;
                    }
                }
                if (string.IsNullOrEmpty(input.MileStoneName) == true)
                {
                    if (string.IsNullOrEmpty(value.MileStoneName) == false)
                    {
                        Data.MileStoneName = value.MileStoneName;
                    }
                }
                if (string.IsNullOrEmpty(input.EnquiryStatus) == true)
                {
                    if (string.IsNullOrEmpty(value.EnquiryStatus) == false)
                    {
                        Data.EnquiryStatus = value.EnquiryStatus;
                    }
                }
                if (string.IsNullOrEmpty(input.TeamName) == true)
                {
                    if (string.IsNullOrEmpty(value.TeamName) == false)
                    {
                        Data.TeamName = value.TeamName;
                    }
                }
                if (string.IsNullOrEmpty(input.DepatmentName) == true)
                {
                    if (string.IsNullOrEmpty(value.DepatmentName) == false)
                    {
                        Data.DepatmentName = value.DepatmentName;
                    }
                }
                if (string.IsNullOrEmpty(input.Categories) == true)
                {
                    if (string.IsNullOrEmpty(value.Categories) == false)
                    {
                        Data.Categories = value.Categories;
                    }
                }
                if (string.IsNullOrEmpty(input.ClosureDate) == true)
                {
                    if (string.IsNullOrEmpty(value.ClosureDate) == false)
                    {
                        Data.ClosureDate = value.ClosureDate;
                    }
                }
                if (string.IsNullOrEmpty(input.LastActivity) == true)
                {
                    if (string.IsNullOrEmpty(value.LastActivity) == false)
                    {
                        Data.LastActivity = value.LastActivity;
                    }
                }
                if (string.IsNullOrEmpty(input.QuotationCreation) == true)
                {
                    if (string.IsNullOrEmpty(value.QuotationCreation) == false)
                    {
                        Data.QuotationCreation = value.QuotationCreation;
                    }
                }



                var val = _viewRepository
                          .GetAll().Where(p => p.Name == input.Name).FirstOrDefault();

                if (val == null)
                {
                    await _viewRepository.InsertAsync(Data);
                }
                else
                {
                    throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in Name '" + input.Name + "' ...");
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #19
0
 /// <summary>
 /// 视图
 /// </summary>
 /// <param name="viewInput"></param>
 /// <returns></returns>
 public ActionResult View(ViewInput viewInput)
 {
     return(Content(GenerateHtml(viewInput), "text/html"));
 }