Ejemplo n.º 1
0
        public MainViewModel(Settings settings)
        {
            _saved = false;
            _queryTextBeforeLeaveResults = "";
            _queryText = "";
            _lastQuery = new Query();

            _settings = settings;

            _historyItemsStorage = new JsonStrorage<History>();
            _userSelectedRecordStorage = new JsonStrorage<UserSelectedRecord>();
            _topMostRecordStorage = new JsonStrorage<TopMostRecord>();
            _history = _historyItemsStorage.Load();
            _userSelectedRecord = _userSelectedRecordStorage.Load();
            _topMostRecord = _topMostRecordStorage.Load();

            ContextMenu = new ResultsViewModel(_settings);
            Results = new ResultsViewModel(_settings);
            History = new ResultsViewModel(_settings);
            _selectedResults = Results;

            InitializeKeyCommands();
            RegisterResultsUpdatedEvent();

            SetHotkey(_settings.Hotkey, OnHotkey);
            SetCustomPluginHotkey();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Perform a query.
        /// </summary>
        /// <param name="q"></param>
        /// <returns></returns>
        public ActionResult Search(NianQueryViewModel q)
        {
            if (q == null || !ModelState.IsValid || string.IsNullOrWhiteSpace(q.Text))
            {
                Response.StatusCode = (int)HttpStatusCode.BadRequest;
                return Json("Invalid request", JsonRequestBehavior.AllowGet);
            }

            var sw = Stopwatch.StartNew();
            var matches = MvcApplication.NianFinder.Nine(q.Text);
            sw.Stop();
            double millis = 1000.0 * sw.ElapsedTicks / Stopwatch.Frequency;
            int nodes = MvcApplication.WordFinder.Nodes;
            var results = new ResultsViewModel(q.Text, matches, millis, nodes);
            Log.Info(CultureInfo.InvariantCulture, "Nian query '{0}',{1},{2:F2}", q.Text, nodes, millis);

            // save query
            using (var session = MvcApplication.DocumentStore.OpenSession())
            {
                session.Store(new Query
                {
                    Type = QueryType.Nian,
                    Text = q.Text,
                    Nodes = nodes,
                    ElapsedMilliseconds = millis
                });

                session.SaveChanges();
            }

            return Json(results, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 3
0
        public ActionResult PDCAZone(int?idAudit, int?idResultat)
        {
            ResultsViewModel resultats = new ResultsViewModel();

            resultats.auditid   = idAudit.Value;
            resultats.audit     = ServiceAudit.getAudit(idAudit.Value);
            resultats.resultats = ServiceResultat.getAuditresults(resultats.audit);
            resultats.themes    = ServiceTheme.GetAllThemeswithoutdetaching(resultats.audit);
            ViewBag.idResultat  = idResultat;
            return(View(resultats));
        }
Ejemplo n.º 4
0
        public void Name()
        {
            ProjectBase project = TestHelper.CreateTestProject();
            Experiment experiment = project.Experiments.First() as Experiment;
            experiment.Results.Add(new Result("result", experiment));

            ResultsViewModel viewModel = new ResultsViewModel(experiment);
            Assert.AreEqual("Results", viewModel.Name);
            Assert.AreEqual(1, viewModel.Children.Count);
            Assert.AreEqual("result", viewModel.Children[0].Name);
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Results(SelectorDataViewModel model)
        {
            var dataReader = dataReaderFactory.CreateDataReader(model.DataType);
            var data       = await dataReader.ReadDataAsync(model.From, model.To);

            var income = calculator.CalculateIncomes(model.StartAmount, data);

            var viewModel = new ResultsViewModel(model, data, income);

            return(View(viewModel));
        }
Ejemplo n.º 6
0
        public void ResultsViewModelCreate_CorrectNameAndRoundNo()
        {
            var tourney = Factory.CreateStartedTournament(2, 2, 1).WithJudges(1);

            tourney.Name = "NM";
            var result = new ResultsViewModel(tourney, 1);

            Assert.AreEqual(1, result.RoundNo);
            Assert.AreEqual(2, result.RunCount);
            Assert.AreEqual("NM", tourney.Name);
        }
Ejemplo n.º 7
0
        void Handle_ItemSelected(object sender, Xamarin.Forms.SelectedItemChangedEventArgs e)
        {
            var category  = (Category)e.SelectedItem;
            var locations = dataService.FilterLocations(category.ServiceType);

            var resultsViewModel = new ResultsViewModel
            {
                Locations = locations
            };

            Navigation.PushAsync(new LocationsPage(resultsViewModel));
        }
Ejemplo n.º 8
0
        public void CanGetElectionResult()
        {
            // Prepare
            Party expected = GenerateFakeElectionWithVotes();

            // Execute
            ResultsViewModel result = _countingServices.GetElectionResult(654321);

            // Assert
            Assert.AreEqual(result.SpoiltVoteCount, 1);
            result.LeadingParty.Should().BeEquivalentTo(expected);
        }
Ejemplo n.º 9
0
        public ActionResult SmartResults(Guid resultsId)
        {
            var dbContext = new ApplicationDbContext();
            var res       = dbContext.InterviewResults.Find(resultsId);

            var model = new ResultsViewModel
            {
                Results = res.Results
            };

            return(View(model));
        }
Ejemplo n.º 10
0
        public async Task Web_Home_Index_Post_Return_Correct_Percentage()
        {
            var model = new ResultsViewModel()
            {
                SelectedAuthorityId = 1
            };

            var homeController = GetMockHomeController();
            var result         = await homeController.Index(model) as ViewResult;

            Assert.AreEqual(((decimal)1 / 6).RoundPercentage(), ((ResultsViewModel)result.Model).Ratings.Select(x => x.Percentage).FirstOrDefault());
        }
Ejemplo n.º 11
0
        public async Task Web_Home_Index_Post_Return_Correct_RecordCount()
        {
            var model = new ResultsViewModel()
            {
                SelectedAuthorityId = 1
            };

            var homeController = GetMockHomeController();
            var result         = await homeController.Index(model) as ViewResult;

            Assert.AreEqual(6, ((ResultsViewModel)result.Model).Ratings.Count());
        }
Ejemplo n.º 12
0
        public async Task Web_Home_Index_Post_Return_Selected_Authority()
        {
            var model = new ResultsViewModel()
            {
                SelectedAuthorityId = 1
            };

            var homeController = GetMockHomeController();
            var result         = await homeController.Index(model) as ViewResult;

            Assert.AreEqual(1, ((ResultsViewModel)result.Model).SelectedAuthorityId);
        }
Ejemplo n.º 13
0
        public async Task Web_Home_Index_Post_Return_Valid_Model()
        {
            var model = new ResultsViewModel()
            {
                SelectedAuthorityId = 1
            };

            var homeController = GetMockHomeController();
            var result         = await homeController.Index(model) as ViewResult;

            Assert.IsNotNull(result.Model);
        }
Ejemplo n.º 14
0
        public ActionResult Resultats([Bind] ResultsViewModel resultvm)
        {
            if (ModelState.IsValid)
            {
                ServiceResultat.HandleResultats(resultvm);

                //when successfull it delivers a full list of zones
                return(RedirectToAction("Index"));
            }

            return(View(resultvm));
        }
Ejemplo n.º 15
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (theText != null)
     {
         DataContext = new ResultsViewModel();
         MessageBox.Show(theText);
     }
     else
     {
         MessageBox.Show("Pole nie może być puste!");
     }
 }
Ejemplo n.º 16
0
        public LocationsPage(ResultsViewModel viewModel)
        {
            //BindingContext = new ResultsViewModel();
            Tester = "Does this work?";
            InitializeComponent();
            Title = "Results";

            BindingContext = this.viewModel = viewModel;

            //Locations = dataService.GetLocations();
            //LocationsListView.ItemsSource = Locations;
        }
Ejemplo n.º 17
0
        public async Task <ActionResult> Results(AdvancedSearchCriteria criteria)
        {
            var results = await mediator.SendAsync(new NotificaitonsAdvancedSearch(criteria));

            var model = new ResultsViewModel
            {
                ExportResults = results.ExportResults.ToArray(),
                ImportResults = results.ImportResults.ToArray()
            };

            return(View(model));
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Show the AddView context menu
        /// </summary>

        void ShowAddViewContextMenu()
        {
            List <ResultsViewModel> modelViews = ViewManager.GetResultsViewModels();

            ContextMenuStrip menu = AddViewContextMenu;

            menu.Items.Clear();

            foreach (ResultsViewModel view in modelViews)
            {
                if (!view.ShowInViewsMenu)
                {
                    continue;
                }

                if (Lex.StartsWith(view.Name, "Separator"))
                {
                    menu.Items.Add(new ToolStripSeparator());
                    continue;
                }

                ToolStripMenuItem item = new ToolStripMenuItem();

                ResultsViewModel rvm = view.Clone();                 // get a clone that we can modify
                item.Tag = rvm;

                item.Text = view.Title;

                string imageName = view.CustomViewTypeImageName;
                if (!Lex.IsDefined(imageName))
                {
                    imageName = "Spotfire";
                }

                item.Image = Bitmaps.GetImageFromName(Bitmaps.I.ViewTypeImages, imageName);

                rvm.Query = this.BaseQuery;
                rvm.QueryResultsControl = this;

                item.Click += AddViewMenuItem_Click;

                menu.Items.Add(item);
            }

            int   x = Cursor.Position.X;
            int   y = Tabs.PointToScreen(Tabs.Location).Y + 22;           // +Tabs.DisplayRectangle.Top;
            Point p = new Point(x, y);

            AddViewContextMenu.Show(p);

            return;
        }
Ejemplo n.º 19
0
        public void ContextMenuSelectedIndex_ShouldEqualNoSelectionIndex_WhenInitialized()
        {
            // Arrange
            ResultsViewModel rvm          = new ResultsViewModel();
            Result           result       = new Result();
            ResultViewModel  selectedItem = new ResultViewModel(result);

            selectedItem.ContextMenuItems.Add(new ContextMenuItemViewModel(null, null, null, null, Key.None, ModifierKeys.None, null));
            rvm.SelectedItem = selectedItem;

            // Assert
            Assert.AreEqual(ResultViewModel.NoSelectionIndex, selectedItem.ContextMenuSelectedIndex);
        }
Ejemplo n.º 20
0
 static public void HandleResultats(ResultsViewModel resultvm)
 {
     resultvm.audit = ServiceAudit.getAuditdetached(resultvm.auditid);
     if (!resultvm.audit.isInProgress)
     {
         resultvm.audit.isInProgress = true;
         AddResultats(resultvm);
     }
     else
     {
         UpdateResultats(resultvm);
     }
 }
Ejemplo n.º 21
0
        public async Task Web_Home_Index_Post_Return_Valid_ViewBag()
        {
            var model = new ResultsViewModel()
            {
                SelectedAuthorityId = 1
            };

            var homeController = GetMockHomeController();
            var result         = await homeController.Index(model) as ViewResult;

            Assert.IsNotNull(result.ViewBag.AuthorityList);
            Assert.AreEqual(10, ((SelectList)result.ViewBag.AuthorityList).Count());
        }
Ejemplo n.º 22
0
        public IActionResult Results(ResultsViewModel viewModel, string urn)
        {
            if (ModelState.IsValid)
            {
                SavePupilToSession(viewModel.SelectedID, urn);
                return(RedirectToAction("Reason", new { searchType = viewModel.SearchType, query = viewModel.Query }));
            }
            viewModel.PupilList = _pupilService.GetPupilDetailsList(new SearchQuery {
                Query = viewModel.Query, URN = viewModel.URN, SearchType = viewModel.SearchType
            });

            return(View(viewModel));
        }
Ejemplo n.º 23
0
        public void PropertyTests()
        {
            ResultsViewModel resultsViewModel = CreateResultsViewModel();

            IEnumerable <Result> bestResults = resultsViewModel.BestResults;

            resultsViewModel.BestResults = bestResults;
            resultsViewModel.BestResults = new List <Result>();

            IEnumerable <Result> latestResults = resultsViewModel.LatestResults;

            resultsViewModel.LatestResults = latestResults;
            resultsViewModel.LatestResults = new List <Result>();
        }
Ejemplo n.º 24
0
        public void NewResultsTests()
        {
            // ToDo: This duplicates CreateResultsViewModel because we need access to _resultsService.

            IXamarinWrapper xamarinWrapper = new XamarinWrapperStub();
            IFileHelper     fileHelper     = new FileHelperStub();
            ResultsService  resultsService = new ResultsService(xamarinWrapper, fileHelper);

            ResultsViewModel resultsViewModel = new ResultsViewModel(xamarinWrapper, resultsService);

            IEnumerable <Result> bestResults   = resultsViewModel.BestResults;
            IEnumerable <Result> latestResults = resultsViewModel.LatestResults;

            Result result = new Result(default, 1, 0);
        protected void UpdateResults_Command(object sender, CommandEventArgs e)
        {
            var    raceID = ScheduleGridView.SelectedValue;
            string error  = string.Empty;
            List <ResultsViewModel> results      = new List <ResultsViewModel>();
            ResultsViewModel        singleResult = null;

            foreach (GridViewRow row in ResultsGridView.Rows)
            {
                DropDownList penalties   = (DropDownList)row.FindControl("PenaltyDropDownList");
                TextBox      runTimeText = (TextBox)row.FindControl("RunTimeTextBox");
                Label        name        = (Label)row.FindControl("NameLabel");
                if (runTimeText.Text.Trim().Length < 1 && int.Parse(penalties.SelectedValue) != 4)
                {
                    error = error + $"Cannot enter null values for race times unless vehicle has been scratched - {name.Text}";
                }

                TimeSpan?runTime = null;
                if (runTimeText.Text == "")
                {
                    runTime = null;
                }
                else
                {
                    runTime = TimeSpan.Parse(runTimeText.Text);
                }

                HiddenField raceDetailID = (HiddenField)row.FindControl("RaceDetailID");
                singleResult = new ResultsViewModel()
                {
                    Name         = name.Text,
                    RaceDetailID = int.Parse(raceDetailID.Value),
                    RaceID       = Convert.ToInt32(raceID),
                    RunTime      = runTime,
                    PenaltyID    = int.Parse(penalties.SelectedValue)
                };
                results.Add(singleResult);
            }
            var controller = new RacingController();

            if (error.Trim().Length > 0)
            {
                MessageUserControl2.ShowInfo("Error", error);
            }
            else
            {
                controller.Edit_Results(results);
                LoadRaceTime();
            }
        }
Ejemplo n.º 26
0
        public ActionResult DernierResultats(int id)
        {
            ResultsViewModel resultats = new ResultsViewModel();

            Audit currentaudit = ServiceAudit.getlatestAuditforZone(id);

            resultats.audit = currentaudit;

            resultats.themes = ServiceTheme.GetAllThemeswithoutdetaching(currentaudit);

            resultats.resultats = ServiceResultat.getAuditresults(currentaudit);

            return(View(resultats));
        }
Ejemplo n.º 27
0
        private void PrepareViewBag(ResultsViewModel results)
        {
            if (results.Items.Count == 0)
            {
                ViewBag.AlertIcon = "glyphicon-exclamation-sign";
                ViewBag.AlertType = "danger";
                ViewBag.AlertMsg  = "Es ist ein Fehler aufgetreten.";
                return;
            }

            ViewBag.AlertIcon = "glyphicon-info-sign";
            ViewBag.AlertType = "success";
            ViewBag.AlertMsg  = "Es " + (results.Items.Count == 1 ? "wurde " : "wurden ") + results.Items.Count + (results.Items.Count == 1 ? " Eintrag" : " Einträge") + " zurückgeliefert.";
        }
Ejemplo n.º 28
0
        public ActionResult Results(ResultsViewModel m)
        {
            ViewBag.aList = db.Amenities.OrderBy(x => x.AmenityName).ToList();
            string [] k = Request.Form.GetValues("keys");

            List <Park> originalParks = new List <Park>();

            foreach (var i in k)
            {
                int  j    = Convert.ToInt32(i);
                Park park = db.Parks.Find(j);
                originalParks.Add(park);
            }

            List <string> amList = new List <string>();

            foreach (string x in Request.Form.Keys)
            {
                if (x != "keys")
                {
                    foreach (string y in Request.Form.GetValues(x))
                    {
                        amList.Add(y);
                    }
                }
            }
            ResultsViewModel vm = new ResultsViewModel();

            foreach (Park p in originalParks)
            {
                int amFound = 0;
                foreach (var a in amList)
                {
                    //bool found = false;
                    foreach (var an in p.ParkAmenities)
                    {
                        if (an.Amenity.AmenityName == a /*&& vm.Parks.Contains(p)==false*/)
                        {
                            amFound++;
                        }
                    }
                }
                if (amFound == amList.Count)
                {
                    vm.Parks.Add(p);
                }
            }
            return(View(vm));
        }
Ejemplo n.º 29
0
        private ResultsViewModel GetRecipeWhereIdIsFirstOrDefault(int id)
        {
            RecipeDAL recipeDAL = _recipeDbContext.Favorites
                                  .Where(recipe => recipe.ID == id)
                                  .FirstOrDefault();

            var recipe = new ResultsViewModel();

            recipe.ID        = recipeDAL.ID;
            recipe.title     = recipeDAL.title;
            recipe.href      = recipeDAL.href;
            recipe.thumbnail = recipeDAL.thumbnail;

            return(recipe);
        }
        public IActionResult ResultsMap(ResultsFilter filter)
        {
            var subjects = _api.GetSubjects();

            filter.qualifications = !string.IsNullOrWhiteSpace(filter.qualifications) ? filter.qualifications : string.Join(",", Enum.GetNames(typeof(QualificationOption)));

            FilteredList <Subject> filteredSubjects;

            if (filter.SelectedSubjects.Count > 0)
            {
                filteredSubjects = new FilteredList <Subject>(
                    subjects.Where(subject => filter.SelectedSubjects.Contains(subject.Id)).ToList(),
                    subjects.Count
                    );
            }
            else
            {
                filteredSubjects = new FilteredList <Subject>(subjects, subjects.Count);
            }

            var mapsEnabled = _featureFlags.Maps;

            PaginatedList <Course> courses;
            var queryFilter = filter.ToQueryFilter();

            var viewModel = new ResultsViewModel
            {
                Subjects    = filteredSubjects,
                FilterModel = filter,
                MapsEnabled = mapsEnabled
            };

            queryFilter.pageSize = 0;
            courses = _api.GetCourses(queryFilter);
            var courseGroups = GroupByProvider(courses);

            IMapProjection <CourseGroup> mapProjection = new MapProjection <CourseGroup>(courseGroups, filter.Coordinates, 400, filter.zoomlevel);

            viewModel.Map = new MapViewModel
            {
                CourseGroups = mapProjection.Markers,
                MyLocation   = filter.Coordinates,
                Map          = mapProjection,
            };
            viewModel.Courses = courses;

            return(View(viewModel));
        }
Ejemplo n.º 31
0
        public ActionResult Results()
        {
            var model = new ResultsViewModel
            {
                Houses = Context.Houses.ToList()
            };

            return(new ViewResult
            {
                ViewName = "Results",
                ViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), ModelState)
                {
                    Model = model
                }
            });
        }
Ejemplo n.º 32
0
        public void SelectNextContextMenuItem_DoesnNotIncrementContextMenuSelectedIndex_WhenCalledOnLastItem()
        {
            // Arrange
            ResultsViewModel rvm          = new ResultsViewModel();
            Result           result       = new Result();
            ResultViewModel  selectedItem = new ResultViewModel(result);

            selectedItem.ContextMenuItems.Add(new ContextMenuItemViewModel(null, null, null, null, Key.None, ModifierKeys.None, null));
            rvm.SelectedItem = selectedItem;

            // Act
            rvm.SelectNextContextMenuItem();

            // Assert
            Assert.AreEqual(0, selectedItem.ContextMenuSelectedIndex);
        }
Ejemplo n.º 33
0
        public void ContextMenuSelectedIndex_ShouldEqualNoSelectionIndex_WhenInitialized()
        {
            // Arrange
            ResultsViewModel rvm          = new ResultsViewModel();
            Result           result       = new Result();
            ResultViewModel  selectedItem = new ResultViewModel(result);

            selectedItem.ContextMenuItems.Add(new ContextMenuItemViewModel()
            {
                Title = "Dummy Context Menu"
            });
            rvm.SelectedItem = selectedItem;

            // Assert
            Assert.AreEqual(selectedItem.ContextMenuSelectedIndex, ResultViewModel.NoSelectionIndex);
        }
Ejemplo n.º 34
0
        public ShellViewModel(
            IWindowManager windowManager,
            IHierarchyManager hierarchyManager,
            IEventAggregator eventAggregator,
            CashflowViewModel casflowViewModel,
            MixedAnalysisViewModel mixedAnalysisViewModel,
            ResultsViewModel resultsViewModel)
        {
            this.DisplayName = "Business valuation using CW";
            this.eventAggregator = Contract.NotNull(eventAggregator, "eventAggregator");
            this.hierarchyManager = Contract.NotNull(hierarchyManager, "hierarchyManager");
            this.windowManager = Contract.NotNull(windowManager, "windowManager");

            this.Cashflow = Contract.NotNull(casflowViewModel, "casflowViewModel");
            this.MixedAnalysis = Contract.NotNull(mixedAnalysisViewModel, "mixedAnalysisViewModel");
            this.Results = Contract.NotNull(resultsViewModel, "resultsViewModel");

            this.eventAggregator.PublishOnUIThread(new DataChangedEvent());
        }
Ejemplo n.º 35
0
 private void InitializeContextMenu()
 {
     ContextMenu = new ResultsViewModel();
     IsContextMenuVisible = false;
 }
        public async Task<ActionResult> Results(AdvancedSearchCriteria criteria)
        {
            var results = await mediator.SendAsync(new NotificaitonsAdvancedSearch(criteria));

            var model = new ResultsViewModel
            {
                ExportResults = results.ExportResults.ToArray(),
                ImportResults = results.ImportResults.ToArray()
            };

            return View(model);
        }
Ejemplo n.º 37
0
        private void QueryHistory()
        {
            const string id = "Query History ID";
            var query = QueryText.ToLower().Trim();
            History.Clear();

            var results = new List<Result>();
            foreach (var h in _history.Items)
            {
                var title = _translator.GetTranslation("executeQuery");
                var time = _translator.GetTranslation("lastExecuteTime");
                var result = new Result
                {
                    Title = string.Format(title, h.Query),
                    SubTitle = string.Format(time, h.ExecutedDateTime),
                    IcoPath = "Images\\history.png",
                    OriginQuery = new Query { RawQuery = h.Query },
                    Action = _ =>
                    {
                        SelectedResults = Results;
                        QueryText = h.Query;
                        return false;
                    }
                };
                results.Add(result);
            }

            if (!string.IsNullOrEmpty(query))
            {
                var filtered = results.Where
                (
                    r => StringMatcher.IsMatch(r.Title, query) ||
                         StringMatcher.IsMatch(r.SubTitle, query)
                ).ToList();
                History.AddResults(filtered, id);
            }
            else
            {
                History.AddResults(results, id);
            }
        }
Ejemplo n.º 38
0
        private void InitializeKeyCommands()
        {
            EscCommand = new RelayCommand(_ =>
            {
                if (!ResultsSelected())
                {
                    SelectedResults = Results;
                }
                else
                {
                    MainWindowVisibility = Visibility.Collapsed;
                }
            });

            SelectNextItemCommand = new RelayCommand(_ =>
            {
                SelectedResults.SelectNextResult();
            });

            SelectPrevItemCommand = new RelayCommand(_ =>
            {
                SelectedResults.SelectPrevResult();
            });

            SelectNextPageCommand = new RelayCommand(_ =>
            {
                SelectedResults.SelectNextPage();
            });

            SelectPrevPageCommand = new RelayCommand(_ =>
            {
                SelectedResults.SelectPrevPage();
            });

            StartHelpCommand = new RelayCommand(_ =>
            {
                Process.Start("http://doc.getwox.com");
            });

            OpenResultCommand = new RelayCommand(index =>
            {
                var results = SelectedResults;

                if (index != null)
                {
                    results.SelectedIndex = int.Parse(index.ToString());
                }

                var result = results.SelectedItem?.Result;
                if (result != null) // SelectedItem returns null if selection is empty.
                {
                    bool hideWindow = result.Action != null && result.Action(new ActionContext
                    {
                        SpecialKeyState = GlobalHotkey.Instance.CheckModifiers()
                    });

                    if (hideWindow)
                    {
                        MainWindowVisibility = Visibility.Collapsed;
                    }

                    if (ResultsSelected())
                    {
                        _userSelectedRecord.Add(result);
                        _history.Add(result.OriginQuery.RawQuery);
                    }
                }
            });

            LoadContextMenuCommand = new RelayCommand(_ =>
            {
                if (ResultsSelected())
                {
                    SelectedResults = ContextMenu;
                }
                else
                {
                    SelectedResults = Results;
                }
            });

            LoadHistoryCommand = new RelayCommand(_ =>
            {
                if (ResultsSelected())
                {
                    SelectedResults = History;
                    History.SelectedIndex = _history.Items.Count - 1;
                }
                else
                {
                    SelectedResults = Results;
                }
            });
        }
Ejemplo n.º 39
0
 private void InitializeResultListBox()
 {
     Results = new ResultsViewModel(_settings);
     ResultListBoxVisibility = Visibility.Collapsed;
 }
Ejemplo n.º 40
0
 private void InitializeContextMenu()
 {
     ContextMenu = new ResultsViewModel(_settings);
     ContextMenuVisibility = Visibility.Collapsed;
 }
Ejemplo n.º 41
0
        public ActionResult Results(IndexViewModel inputModel)
        {
            var inputs =Request.QueryString.Count < 5 ? inputModel.UserInput  : CreateInputsFromQuery(Request.QueryString);
            var results = GetResultsFromTaco(inputs);
            if (inputs.MinEff == 0) inputs.MinEff = 50;
            var sb = new StringBuilder();
            foreach(var result in results.results)
            {
                sb.Append(result.model_no + ",");
            }
            var prodNumbers = sb.ToString();
            prodNumbers.TrimEnd(',');
            var ENGworksResponse = GetENGworksResponse(prodNumbers);
            foreach(var result in results.results)
            {
                var ENGworks = (from p in ENGworksResponse.Objects where p.model_no == result.model_no select p).FirstOrDefault();
                if (ENGworks != null && ENGworks.FoundInENGworksDB)
                {
                    result.PreviewImage = ENGworks.RevitFamilyName;
                    result.DownloadGuid = ENGworks.URL;
                    result.isENGworksAvailable = true;
                }
                else
                {
                    result.PreviewImage = "Preview-Not-Available";
                    result.isENGworksAvailable = false;
                }

                result.QueryString = inputs.ToQueryString;
                result.head = inputs.TotalHead.ToString();
            }
            var model = new ResultsViewModel { Pumps = results.results };

            return View("Results", model);
        }
Ejemplo n.º 42
0
 private void InitializeResultListBox()
 {
     Results = new ResultsViewModel();
     IsResultListBoxVisible = false;
 }