Ejemplo n.º 1
0
        public void GroupItems()
        {
            DisplayItem newDisplayItem;

            newDisplayItem       = new DisplayItem();
            newDisplayItem.Shape = new PreviewCustom(new PreviewPoint(100, 100), SelectedShapes());
            AddDisplayItem(newDisplayItem);
            Console.Write("Grouped");
            foreach (DisplayItem item in SelectedDisplayItems)
            {
                DisplayItems.Remove(item);
            }

            _selectedDisplayItem = newDisplayItem;
            if (_selectedDisplayItem != null)
            {
                PreviewCustomCreateForm f = new PreviewCustomCreateForm();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    _selectedDisplayItem.Shape.Name = f.TemplateName;
                    _selectedDisplayItem.Shape.Select(true);

                    string xml          = PreviewTools.SerializeToString(_selectedDisplayItem);
                    string destFileName = PreviewTools.TemplateWithFolder(f.TemplateName + ".xml");
                    System.IO.File.WriteAllText(destFileName, xml);

                    OnSelectDisplayItem(this, _selectedDisplayItem);
                }
            }
        }
Ejemplo n.º 2
0
        private void MoveUp()
        {
            var currentDisplayElement = CurrentDisplayElement;
            var index = DisplayItems.IndexOf(currentDisplayElement);

            DisplayItems.Move(index, index - 1);
        }
Ejemplo n.º 3
0
        private void updateDisplayItemsAndCaption(IFileListViewModel flvm)
        {
            SelectionCount = flvm.Selection.SelectedItems.Count();

            Metadata.LoadAsync(UpdateMode.Replace, true, flvm);
            DisplayItems.Clear();
            switch (SelectionCount)
            {
            case 0:
                //Caption = String.Format(NoneSelected, flvm.CurrentDirectory.EntryModel.Label);

                DisplayItems.Add(EntryViewModel.FromEntryModel(flvm.CurrentDirectory));
                break;

            case 1:
                //Caption = String.Format(OneSelected, flvm.SelectedItems.First().EntryModel.Label);
                DisplayItems.Add(flvm.Selection.SelectedItems.First());
                break;

            default:
                //Caption = String.Format(ManySelected, flvm.SelectedItems.Count.ToString());
                DisplayItems.AddRange(flvm.Selection.SelectedItems.Take(5));
                break;
            }
        }
Ejemplo n.º 4
0
        private void DoQuery(QueryInput queryInput)
        {
            var items = DataBase.Instance.Execute(queryInput);

            DisplayItems.Clear();
            DisplayItems.AddRange(items);
        }
Ejemplo n.º 5
0
 public void LogFinish()
 {
     lock (lockObj)
     {
         if (!logFinished)
         {
             if (DisplayItems == null)
             {
                 DisplayItems = new Dictionary <string, string>();
             }
             DisplayItems.Add("Url", RequestURL);
             DisplayItems.Add("Method", HttpMethod);
             DisplayItems.Add("Logs", string.Join(",", LogMessageItemList)?.TrimEnd('|') ?? "无");
             DisplayItems.Add("ES", ElapsedMilliseconds.ToString());
             if (!string.IsNullOrWhiteSpace(Params))
             {
                 Message += $"{Environment.NewLine}请求参数:{Params}";
             }
             if (!string.IsNullOrWhiteSpace(RespContent))
             {
                 Message += $"{Environment.NewLine}返回结果:{RespContent}";
             }
             if (ClientIPList != null)
             {
                 DisplayItems.Add("CIP", string.Join(",", ClientIPList));
             }
             logFinished = true;
         }
     }
 }
Ejemplo n.º 6
0
        public void Add_Entry(object sender, EventArgs e)
        {
            DataEntry asdf = new DataEntry(controlGeneral.Title + " Log #" + counter);

            DisplayItems.Add(asdf);
            counter++;
        }
        public override void Initialize(Sitecore.Mvc.Presentation.Rendering rendering)
        {
            base.Initialize(rendering);

            ImageFieldName   = Rendering.Parameters[MobileFieldNames.SlideshowViewRenderingParameters.ImageFieldName];
            CaptionFieldName = Rendering.Parameters[MobileFieldNames.SlideshowViewRenderingParameters.CaptionFieldName];

            JsonParameters = Rendering.Parameters[MobileFieldNames.SlideshowViewRenderingParameters.JsonParameters];

            int w = 400;
            int h = 240;

            int.TryParse(Rendering.Parameters[MobileFieldNames.SlideshowViewRenderingParameters.ImageWidth], out w);
            int.TryParse(Rendering.Parameters[MobileFieldNames.SlideshowViewRenderingParameters.ImageHeight], out h);

            ImageWidth  = w;
            ImageHeight = h;

            DisplayItems = DisplayItems.Where(i => !string.IsNullOrEmpty(i[ImageFieldName])).ToArray();

            List <SlideshowDisplayItem> resultItems = new List <SlideshowDisplayItem>();

            foreach (var i in DisplayItems)
            {
                resultItems.Add(new SlideshowDisplayItem(i, ImageFieldName));
            }
            SlideshowDisplayItems = resultItems.ToArray();
        }
Ejemplo n.º 8
0
        public BrowserTabViewModel()
        {
            Layout = (Layout)Settings.Layout;

            UpdateFilterCriteria();
            Settings.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "ShowHiddenItems" || (e.PropertyName == "ShowSystemItems"))
                {
                    UpdateFilterCriteria();
                }

                SaveSettings();
            };

            Messenger.Default.Register(this, (NotificationMessage message) =>
            {
                if (message.NotificationType == NotificationType.Add && CurrentFolder.FullPath.OrdinalEquals(FileSystemHelper.GetParentFolderPath(message.Path)))
                {
                    FileModel fileModel = FileModel.FromPath(message.Path);
                    if (!DisplayItems.Contains(fileModel))
                    {
                        DisplayItems.Add(fileModel);
                    }
                }
                else if (message.NotificationType == NotificationType.Remove && message.Path.OrdinalStartsWith(CurrentFolder.FullPath))
                {
                    FileModel fileModel = DisplayItems.FirstOrDefault(x => x.FullPath.OrdinalEquals(message.Path));
                    if (fileModel != null)
                    {
                        DisplayItems.Remove(fileModel);
                    }
                }
            });
        }
        public StoreSectionViewModel(DatabaseService database, IMessageBox mb)
        {
            try
            {
                _db         = database;
                _messageBox = mb;
            }
            catch (Exception e)
            {
                _messageBox.OpenMessageBox("Noget gik galt! Check Debug for fejlmeddelelse");
                Debug.WriteLine(e.Message);
            }
            ShapeCollection = new ObservableCollection <SectionShape>();
            ListOfItems     = new DisplayItems();

            WindowLoadedCommand = new RelayCommand(windowLoadedHandler);
            SelectCurrentStoreSectionCommand = new RelayCommand <SectionShape>(selectCurrentStoreSectionHandler);
            DeleteStoreSectionCommand        = new RelayCommand(deleteStoreSectionHandler, () => _selectedStoreSection != 0);
            EditStoreSectionCommand          = new RelayCommand(editStoreSectionHandler, () => _selectedStoreSection != 0);
            SearchItemsCommand              = new RelayCommand(searchItemsHandler);
            AddItemToSectionCommand         = new RelayCommand(addItemToSectionHandler, () => _selectedStoreSection != 0);
            RemoveItemFromSectionCommand    = new RelayCommand(removeItemFromSectionHandler, () => _selectedStoreSection != 0);
            AddStoreSectionCommand          = new RelayCommand(AddStoreSectionDialogOkButtonHandler, () => CheckValidName(NewlyCreatedStoreSectionName));
            CancelStoreSectionCommand       = new RelayCommand(AddStoreSectionDialogCancelButtonHandler);
            EditStoreSectionDialogOKCommand = new RelayCommand(editStoreSectionButtonOKHandler, () => CheckValidName(NewSectionName));
        }
Ejemplo n.º 10
0
        public void LogFinish()
        {
            if (logFinished)
            {
                return;
            }
            if (DisplayItems == null)
            {
                DisplayItems = new Dictionary <string, string>();
            }

            DisplayItems.Add("Url", RequestURL);
            DisplayItems.Add("Method", HttpMethod);
            DisplayItems.Add("ES", ElapsedMilliseconds.ToString());
            if (LogMessageItemList != null && LogMessageItemList.Count > 0)
            {
                DisplayItems.Add("Logs", string.Join(",", LogMessageItemList)?.TrimEnd('|') ?? "无");
            }
            if (ClientIPList != null)
            {
                DisplayItems.Add("CIP", string.Join(",", ClientIPList));
            }
            if (!string.IsNullOrWhiteSpace(Params))
            {
                Message += Environment.NewLine + $"请求参数:{Environment.NewLine}{Params}";
            }
            CutRespContent();
            logFinished = true;
        }
Ejemplo n.º 11
0
 void Start()
 {
     Spew.playerScript = this;
     LevelManager.instance.subscribeToGoal(this);
     Debug.Log("" + Spew.playerScript);
     InvokeRepeating("drainHealth", 2, 2f);
     itemsUI = GameObject.FindGameObjectWithTag("UI Item").GetComponent <DisplayItems>();
 }
Ejemplo n.º 12
0
 public void Delete()
 {
     if (_selectedDisplayItem != null)
     {
         DisplayItems.Remove(_selectedDisplayItem);
         DeSelectSelectedDisplayItem();
     }
 }
Ejemplo n.º 13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Perform any additional setup after loading the view, typically from a nib.
            TableView.RegisterNibForCellReuse(UINib.FromName(Constants.FilterCellViewControllerName, null),
                                              Constants.FilterCellIdentifier);
            TableView.CellLayoutMarginsFollowReadableWidth = true;

            TableView.RegisterNibForHeaderFooterViewReuse(UINib.FromName(Constants.FilterCellViewControllerName, null),
                                                          Constants.FilterCellIdentifier);

            // Setting up items for searchbar to search
            FilteredItems = DisplayItems;
            TableView.UserInteractionEnabled = true;
            TableView.AllowsSelection        = true;
            TableView.CellLayoutMarginsFollowReadableWidth = true;

            _searchBar = new UISearchBar {
                WeakDelegate = this
            };

            ConfigureMegaSection();

            // position search bar
            SearchView.AddSubview(_searchBar);
            _searchBar.SizeToFit();
            _searchBar.Frame = new CGRect(0,
                                          Constants.SearchViewHeight - _searchBar.Frame.Height - Constants.SearchbarPadding,
                                          Constants.TableRowWidth, _searchBar.Frame.Height);

            // style of search bar
            _searchBar.BarStyle        = UIBarStyle.Black;
            _searchBar.BackgroundColor = Constants.SearchbarBackgroundColor;
            _searchBar.SearchBarStyle  = UISearchBarStyle.Minimal;

            // hide cancel button on search bar to begin
            _searchBar.ShowsCancelButton    = false;
            _searchBar.CancelButtonClicked += _searchBar_CancelButtonClicked;

            // set up delegates to handle events on search bar
            _searchBar.TextChanged += CancelButtonStyle;
            _searchBar.TextChanged += UpdateSearchResultsForSearchController;

            CreateNoResultPage();

            // Set class counts for sidebar header
            SelectedClassCount = DisplayItems.Count();

            GenerateColoursInUse();

            _sectionHeaderHeight = TableView.SectionHeaderHeight;

            CheckboxState = new Dictionary <Category, bool>();
        }
        /// <summary>
        /// Setting all the information(DestFolder, FolderPath) to <see cref="DisplayItems"/>
        /// </summary>
        private void SetItemsInformation()
        {
            // Getting all the infomation to Items
            foreach (var folder in ViewModelLocator.CacheViewModel.Details.SourceFolders)
            {
                DisplayItemControlViewModel displayItemControlViewModel =
                    new DisplayItemControlViewModel(_DialogService, _BackupService, folder, $"{ViewModelLocator.CacheViewModel.Details.DestFolder}\\{folder.FolderInfo.Name}");

                DisplayItems.Add(displayItemControlViewModel);
            }
        }
Ejemplo n.º 15
0
        public TagArchiveNodeSource(string name, GameDefinition game, IDocumentManager documentManager,
                                    DisplayItems items, DefaultState defaultState)
            : base(name)
        {
            this.game          = game;
            Library.FileAdded += new EventHandler <LibraryFileActionArgs>(Library_FileAdded);
            this.items         = items;

            // Add NodeTypes
            if ((items & DisplayItems.AllExtractedItems) > 0)
            {
                AddNodeType(CreateNodeType <RootNodeType>(defaultState));

                FolderNodeType folder = CreateNodeType <FolderNodeType>(Resources.folder16, Resources.folder_closed16);
                AddNodeType(folder);

                FileNodeType file = CreateNodeType <FileNodeType>(Resources.document16);
                file.AddNodeState(new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.document_view16, Resources.document_view16, Color.Blue, Color.White));
                AddNodeType(file);

                ObjectFileNodeType objectFile = CreateNodeType <ObjectFileNodeType>(Resources.data16);
                objectFile.AddNodeState(new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.data_view16, Resources.data_view16, Color.Blue, Color.White));
                AddNodeType(objectFile);

                ModelFileNodeType modelFile = CreateNodeType <ModelFileNodeType>(Resources.cube_molecule16);
                modelFile.AddNodeState(new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.cube_molecule_view16, Resources.cube_molecule_view16, Color.Blue, Color.White));
                AddNodeType(modelFile);

                SbspFileNodeType sbspFile = CreateNodeType <SbspFileNodeType>(Resources.environment16);
                sbspFile.AddNodeState(new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.environment_view16, Resources.environment_view16, Color.Blue, Color.White));
                AddNodeType(sbspFile);

                ScenarioFileNodeType scenarioFile = CreateNodeType <ScenarioFileNodeType>(Resources.earth16);
                scenarioFile.AddNodeState(new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.earth_view16, Resources.earth_view16, Color.Blue, Color.White));
                AddNodeType(scenarioFile);

                AttachedScriptNodeType attachedScript = CreateNodeType <AttachedScriptNodeType>(Resources.text_code_colored16);
                attachedScript.AddNodeState(new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.text_view16, Resources.text_view16, Color.Blue, Color.White));
                AddNodeType(attachedScript);
            }

            if ((items & DisplayItems.AllUnextractedItems) > 0)
            {
                AddNodeType(CreateNodeType <UnextractedRootNodeType>(defaultState));

                UnextractedFolderNodeType unextractedfolder = CreateNodeType <UnextractedFolderNodeType>(
                    new DefaultState(Resources.folder16, Resources.folder_closed16, Color.Gray, Color.White));
                AddNodeType(unextractedfolder);

                UnextractedFileNodeType unextractedfile = CreateNodeType <UnextractedFileNodeType>(
                    new DefaultState(Resources.document_text16, Resources.document_text16, Color.Gray, Color.White));
                AddNodeType(unextractedfile);
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Configure the subtitle of sidebar
        /// </summary>
        private void ConfigureSidebarSubtitle()
        {
            var categoryCount = DisplayItems.Count();

            NumberSelected.Text = string.Format(CultureInfo.CurrentCulture,
                                                categoryCount > 1
                    ? SharedConstants.SidebarSubtitleFormatPlural
                    : SharedConstants.SidebarSubtitleFormatSingular,
                                                SelectedClassCount, categoryCount);

            Constraints[Constants.DefaultHeightConstraintKey].Constant = SideBarView.Frame.Height;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Show or hide bounding box according to switch toggle.
        /// </summary>
        /// <param name="searchString"> the string with which the search is conducted</param>
        /// <returns> the categories whose labels begin with the searchString</returns>
        private IEnumerable <Category> PerformSearch(string searchString)
        {
            TableView.SectionHeaderHeight = string.IsNullOrEmpty(searchString)
                ? _sectionHeaderHeight
                : Constants.SectionHeaderClear;
            searchString = searchString != null?searchString.Trim() : "";

            var filteredCategories = DisplayItems
                                     .Where(o => o.Label.IndexOf(searchString, StringComparison.OrdinalIgnoreCase) >= 0).ToList();

            return(filteredCategories.Distinct().ToList());
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Writes a line of text to the display with custom display options.
 /// </summary>
 /// /// <param name="displayMode">The custom display mode.</param>
 /// <param name="text">The text to be written.</param>
 /// <param name="args">An object or objects to write using format.</param>
 public void WriteLine(DisplayMode displayMode, string text, params object[] args)
 {
     if (args.Length == 0)
     {
         text = text.Replace("{", "{{").Replace("}", "}}");
     }
     DisplayItems.Add(new DisplayItem
     {
         Text        = string.Format(text, args),
         DisplayMode = displayMode
     });
 }
 public override IModuleDataModel Clone()
 {
     return(new DisplayPreviewModuleDataModel
     {
         BackgroundImage = BackgroundImage,
         DisplayItems =
             new ObservableCollection <DisplayItem>(DisplayItems.Select(displayItem => displayItem.Clone()).ToList()),
         DisplayHeight = DisplayHeight,
         DisplayWidth = DisplayWidth,
         Opacity = Opacity,
         Preferences = Preferences.Clone(),
     });
 }
        private void CountProgress_ProgressChanged(object sender, int e)
        {
            if (DisplayItems.Count != 0)
            {
                CompletedItemsCount = (e * 100) / DisplayItems.Count;

                // If the backup is done clear the existing items
                if (e == DisplayItems.Count)
                {
                    DisplayItems.Clear();
                }
            }
        }
Ejemplo n.º 21
0
    public SelectorViewModel(List <SelectorComboBoxItem> displayItems, object nestedViewModel, Action <int> onSelectedChanged, Func <int, bool> validateId)
    {
        _validateId = validateId;
        foreach (var item in displayItems)
        {
            DisplayItems.Add(item);
        }

        _onSelectedChanged = onSelectedChanged;
        NestedViewModel    = nestedViewModel;
        _selected          = DisplayItems.First().Id;
        UpdateNestedViewModel();
        RaisePropertyChanged(nameof(Selected));
    }
Ejemplo n.º 22
0
        /// <summary>
        ///   The add element.
        /// </summary>
        private void AddElement()
        {
            var displayElement = new DisplayItem();
            var viewModel      = new DisplayItemEditorViewModel {
                DisplayItem = displayElement
            };
            var editor = new DisplayItemEditorView {
                DataContext = viewModel
            };

            editor.ShowDialog();
            DisplayItems.Add(displayElement);
            CurrentDisplayElement = displayElement;
        }
        public TagArchiveObjectViewNodeSource(string name, GameDefinition game, IDocumentManager documentManager,
                                              DisplayItems items, DefaultState defaultState, bool loadDependencies)
            : base(name)
        {
            this.game             = game;
            this.items            = items;
            this.loadDependencies = loadDependencies;
            Library.FileAdded    += new EventHandler <LibraryFileActionArgs>(Library_FileAdded);

            if ((items & DisplayItems.AllExtractedItems) > 0)
            {
                AddNodeType(CreateNodeType <ObjectViewRootNodeType>(defaultState));

                HLTGroupNodeType groups = CreateNodeType <HLTGroupNodeType>(
                    new DefaultState(Resources.book_open16, Resources.book_blue16, Color.Black, Color.White));
                AddNodeType(groups);

                HLTNodeType htlType = CreateNodeType <HLTNodeType>(Resources.data16);
                htlType.AddNodeState(
                    new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.data_view16, Resources.data_view16, Color.Blue, Color.White));
                AddNodeType(htlType);

                TagNodeType tagType = CreateNodeType <TagNodeType>(Resources.document_up16);
                tagType.AddNodeState(
                    new DocumentOpenState(documentManager, game.GameID, TagLocation.Archive, Resources.document_view16, Resources.document_view16, Color.Blue,
                                          Color.White));
                AddNodeType(tagType);
            }
            if ((items & DisplayItems.AllUnextractedItems) > 0)
            {
                AddNodeType(CreateNodeType <UnextractedObjectViewRootNodeType>(defaultState));

                UnextractedHLTGroupNodeType unextractedHLTGroup = CreateNodeType <UnextractedHLTGroupNodeType>(
                    new DefaultState(Resources.book_open16, Resources.book_blue16, Color.Gray, Color.White));
                AddNodeType(unextractedHLTGroup);

                UnextractedHLTNodeType unextractedHLT = CreateNodeType <UnextractedHLTNodeType>(
                    new DefaultState(Resources.data16, Resources.data16, Color.Gray, Color.White));
                AddNodeType(unextractedHLT);
            }
        }
        public ItemViewModel(IDatabaseService db, IMessageBox mb)
        {
            try
            {
                _db           = db;
                _messageBox   = mb;
                ListOfItems   = new DisplayItems();
                ComboBoxIndex = -1;
                bool dummybool = false;
                DeleteItemCommand = new RelayCommand(deleteItemHandler, () => ListOfItems.CurrentIndex >= 0);
                CreateItemCommand = new RelayCommand(addItemHandler, () => ComboBoxIndex != -1);
                EditItemCommand   = new RelayCommand(() => MessageBox.Show("Not Implemented"), () => dummybool == true);
                SearchItemCommand = new RelayCommand(searchItemHandler, () => dummybool == false);

                ListOfItems.Populate(_db.TableItem.SearchItems(""));
            }
            catch (Exception e)
            {
                _messageBox.OpenMessageBox("Noget gik galt! Check Debug for fejlmeddelelse");
                Debug.WriteLine(e.Message);
            }
        }
Ejemplo n.º 25
0
 /// <summary>
 /// 结束日志
 /// </summary>
 public void LogFinish()
 {
     try
     {
         lock (lockObj)
         {
             if (logFinished)
             {
                 return;
             }
             DisplayItems.Add("Url", RequestURL);
             DisplayItems.Add("Method", HttpMethod);
             DisplayItems.Add("ES", ElapsedMilliseconds.ToString());
             if (ClientIPList != null)
             {
                 DisplayItems.Add("CIP", string.Join(",", ClientIPList));
             }
             if (!string.IsNullOrWhiteSpace(Params))
             {
                 Message += $"\n请求参数:\n  {Params}";
             }
             bool isNewLine = true;
             if (LogMessageItemList != null && LogMessageItemList.Count > 0)
             {
                 isNewLine = false;
                 Message  += $"\n其他信息:\n{string.Join("", LogMessageItemList.OrderBy(x => x.LogIndex))}";
             }
             //if (RespContent.Length > 2000)
             //{
             //    RespContent = RespContent.Substring(0, 2000);
             //}
             Message    += (isNewLine ? "\n" : string.Empty) + $"返回参数:\n  {RespContent}";
             logFinished = true;
         }
     }
     catch { }
 }
Ejemplo n.º 26
0
        private void DeleteDisplayElement()
        {
            var displayElement = CurrentDisplayElement;

            if (displayElement == null)
            {
                return;
            }

            if (
                MessageBox.Show(
                    string.Format(
                        "Are you sure you want to delete the selected display element named '{0}' ?",
                        displayElement.Name),
                    "Confirm delete",
                    MessageBoxButton.YesNo,
                    MessageBoxImage.Question,
                    MessageBoxResult.No)
                == MessageBoxResult.Yes)
            {
                DisplayItems.Remove(displayElement);
                CurrentDisplayElement = null;
            }
        }
 }// RefreshVariablesValues
 private EigenData computeData(Anacompo p)
 {
     String prefix = this.FactorPrefix;
     EigenData oRet = new EigenData();
     var vals = p.EigenValues;
     int nv = vals.Length;
     double sum = vals.Sum();
     if (sum <= 0.0)
     {
         return null;
     }
     DisplayItemsArray vv = new DisplayItemsArray();
     DisplayItems header = new DisplayItems();
     header.Add(new DisplayItem("Num", true));
     header.Add(new DisplayItem("Facteur", true));
     header.Add(new DisplayItem("Valeur", true));
     header.Add(new DisplayItem("Taux", true));
     header.Add(new DisplayItem("Cummul", true));
     vv.Add(header);
     double s = 0.0;
     for (int i = 0; i < nv; ++i)
     {
         DisplayItems line = new DisplayItems();
         line.Add(new DisplayItem((int)(i + 1)));
         String sname = String.Format("{0}{1}", prefix, i + 1);
         line.Add(new DisplayItem(sname));
         double x = vals[i];
         line.Add(new DisplayItem(x));
         line.Add(new DisplayItem(x / sum));
         s += x;
         line.Add(new DisplayItem(s / sum));
         vv.Add(line);
     }// i
     oRet.EigenValues = vv;
     //
     DisplayItemsArray vecs = new DisplayItemsArray();
     DisplayItems hh = new DisplayItems();
     hh.Add(new DisplayItem("Variable", true));
     var vx = p.EigenVectors;
     nv = vx.GetLength(1);
     int nr = vx.GetLength(0);
     var xnames = this.CurrentVariables.ToArray();
     for (int i = 0; i < nv; ++i)
     {
         String sname = String.Format("{0}{1}", prefix, i + 1);
         hh.Add(new DisplayItem(sname, true));
     }// i
     vecs.Add(hh);
     for (int i = 0; i < nr; ++i)
     {
         DisplayItems line = new DisplayItems();
         String name = xnames[i].Name;
         line.Add(new DisplayItem(name));
         for (int j = 0; j < nv; ++j)
         {
             double x = vx[i, j];
             line.Add(new DisplayItem(x));
         }// j
         vecs.Add(line);
     }// i
     oRet.EigenVectors = vecs;
     //
     DisplayItemsArray vecsv = new DisplayItemsArray();
     DisplayItems hhv = new DisplayItems();
     hhv.Add(new DisplayItem("Variable", true));
     var vxv = p.RecodedVars;
     nv = vxv.GetLength(1);
     nr = vxv.GetLength(0);
     for (int i = 0; i < nv; ++i)
     {
         String sname = String.Format("{0}{1}", prefix, i + 1);
         hhv.Add(new DisplayItem(sname, true));
     }// i
     vecsv.Add(hhv);
     for (int i = 0; i < nr; ++i)
     {
         DisplayItems line = new DisplayItems();
         String name = xnames[i].Name;
         line.Add(new DisplayItem(name));
         for (int j = 0; j < nv; ++j)
         {
             double x = vxv[i, j];
             line.Add(new DisplayItem(x));
         }// j
         vecsv.Add(line);
     }// i
     oRet.EigenVariables = vecsv;
     //
     DisplayItemsArray vecsx = new DisplayItemsArray();
     DisplayItems hhx = new DisplayItems();
     hhx.Add(new DisplayItem("Num", true));
     hhx.Add(new DisplayItem("Index", true));
     hhx.Add(new DisplayItem("Nom", true));
     hhx.Add(new DisplayItem("Photo", true));
     var vxx = p.RecodedInds;
     nv = vxx.GetLength(1);
     nr = vxx.GetLength(0);
     for (int i = 0; i < nv; ++i)
     {
         String sname = String.Format("{0}{1}", prefix, i + 1);
         hhx.Add(new DisplayItem(sname, true));
     }// i
     vecsx.Add(hhx);
     var inds = this.Individus.ToArray();
     for (int i = 0; i < nr; ++i)
     {
         DisplayItems line = new DisplayItems();
         line.Add(new DisplayItem(i+1));
         var ind = inds[i];
         line.Add(new DisplayItem(ind.IndivIndex));
         line.Add(new DisplayItem(ind.IdString));
         line.Add(new DisplayItem(ind.Name));
         if ((ind.PhotoData != null) && (ind.PhotoData.Length > 1))
         {
             line.Add(new DisplayItem(ind.PhotoData));
         }
         else
         {
             line.Add(new DisplayItem());
         }
         for (int j = 0; j < nv; ++j)
         {
             double x = vxx[i, j];
             line.Add(new DisplayItem(x));
         }// j
         vecsx.Add(line);
     }// i
     oRet.EigenIndivs = vecsx;
     return oRet;
 }// computeData
Ejemplo n.º 28
0
        private void RefreshGraph()
        {
            var currentDisplayItems = DisplayItems.ToList();

            DisplayItems = currentDisplayItems;
        }
 public DisplayItemsArray CreateVariablesInfoDisplay(IEnumerable<VariableInfo> oVars)
 {
     DisplayItemsArray oRet = new DisplayItemsArray();
     try
     {
         DisplayItems hh = new DisplayItems();
         hh.Add(new DisplayItem("Num", true));
         hh.Add(new DisplayItem("Variable", true));
         hh.Add(new DisplayItem("N", true));
         hh.Add(new DisplayItem("Min", true));
         hh.Add(new DisplayItem("Max", true));
         hh.Add(new DisplayItem("Median", true));
         hh.Add(new DisplayItem("Mean", true));
         hh.Add(new DisplayItem("Dev.", true));
         hh.Add(new DisplayItem("Skew.", true));
         hh.Add(new DisplayItem("Kurt.", true));
         hh.Add(new DisplayItem("Q05", true));
         hh.Add(new DisplayItem("Q10", true));
         hh.Add(new DisplayItem("Q25", true));
         hh.Add(new DisplayItem("Q75", true));
         hh.Add(new DisplayItem("Q90", true));
         hh.Add(new DisplayItem("Q95", true));
         oRet.Add(hh);
         int icur = 1;
         foreach (var v in oVars)
         {
             DisplayItems line = new DisplayItems();
             line.Add(new DisplayItem(icur++));
             line.Add(new DisplayItem(v.VariableName));
             line.Add(new DisplayItem(v.TotalValuesCount));
             line.Add(new DisplayItem(v.MinValue));
             line.Add(new DisplayItem(v.MaxValue));
             line.Add(new DisplayItem(v.Median));
             line.Add(new DisplayItem(v.MeanValue));
             line.Add(new DisplayItem(v.Deviation));
             line.Add(new DisplayItem(v.Skewness));
             line.Add(new DisplayItem(v.Flatness));
             line.Add(new DisplayItem(v.Quantile05));
             line.Add(new DisplayItem(v.Quantile10));
             line.Add(new DisplayItem(v.Quantile25));
             line.Add(new DisplayItem(v.Quantile75));
             line.Add(new DisplayItem(v.Quantile90));
             line.Add(new DisplayItem(v.Quantile95));
             oRet.Add(line);
         }// v
     }
     catch (Exception /*ex*/)
     {
         oRet = null;
     }
     return oRet;
 }
 public DisplayItemsArray CreateDataDisplay(IEnumerable<IndivDesc> oIndivs,
     IEnumerable<VariableDesc> allVars, IEnumerable<VariableDesc> oVars)
 {
     if ((oIndivs == null) || (allVars == null) || (oVars == null))
     {
         return null;
     }
     if ((oIndivs.Count() < 1) || (allVars.Count() < 1) || (oVars.Count() < 1))
     {
         return null;
     }
     List<DisplayItems> oRet = null;
     try
     {
         var pMan = this.DataService;
         if (pMan == null)
         {
             return null;
         }
         VariableDesc idsvars = null;
         VariableDesc namesvars = null;
         VariableDesc photosvars = null;
         bool bString = true;
         foreach (var v in allVars)
         {
             if (v.IsIdVar)
             {
                 idsvars = v;
             }
             if (v.IsNameVar)
             {
                 namesvars = v;
             }
             if (v.IsImageVar)
             {
                 photosvars = v;
             }
         }// v
         if (photosvars != null)
         {
             String stype = photosvars.DataType.Trim().ToLower();
             if (!stype.Contains("string"))
             {
                 bString = false;
             }
         }// photovars
         var vars = oVars.ToArray();
         int nv = vars.Length;
         oRet = new List<DisplayItems>();
         DisplayItems header = new DisplayItems();
         header.Add(new DisplayItem("Num", true));
         header.Add(new DisplayItem("Index", true));
         header.Add(new DisplayItem("ID", true));
         header.Add(new DisplayItem("Nom", true));
         header.Add(new DisplayItem("Photo", true));
         for (int i = 0; i < nv; ++i)
         {
             header.Add(new DisplayItem(vars[i].Name, true));
         }// i
         oRet.Add(header);
         int irow = 1;
         foreach (var ind in oIndivs)
         {
             DisplayItems line = new DisplayItems();
             line.Add(new DisplayItem(irow++));
             int index = ind.IndivIndex;
             line.Add(new DisplayItem(index));
             String sid = String.Empty;
             if (idsvars != null)
             {
                 var q = from x in ind.Values where x.VariableId == idsvars.Id select x;
                 if (q.Count() > 0)
                 {
                     sid = StatHelpers.ConvertValue(q.First().DataStringValue);
                 }
             }// idsvars
             line.Add(new DisplayItem(sid));
             String sname = String.Empty;
             if (namesvars != null)
             {
                 var q = from x in ind.Values where x.VariableId == namesvars.Id select x;
                 if (q.Count() > 0)
                 {
                     sname = StatHelpers.ConvertValue(q.First().DataStringValue);
                 }
             }// idsvars
             line.Add(new DisplayItem(sname));
             DisplayItem photo = new DisplayItem();
             if (photosvars != null)
             {
                 var q = from x in ind.Values where x.VariableId == photosvars.Id select x;
                 if (q.Count() > 0)
                 {
                     String sval = StatHelpers.ConvertValue(q.First().DataStringValue);
                     if (!String.IsNullOrEmpty(sval))
                     {
                         int nid = 0;
                         String name = null;
                         if (!bString)
                         {
                             double d = 0.0;
                             double.TryParse(sval, out d);
                             nid = (int)d;
                         }
                         else
                         {
                             name = sval;
                         }
                         PhotoDesc p = new PhotoDesc();
                         p.Id = nid;
                         p.Name = name;
                         var xx = pMan.FindPhoto(p);
                         if ((xx != null) && (xx.Item1 != null) && (xx.Item2 == null))
                         {
                             photo = new DisplayItem(xx.Item1.DataBytes);
                         }
                     }// sval
                 }
             }// photos
             line.Add(photo);
             //
             for (int i = 0; i < nv; ++i)
             {
                 String sval = String.Empty;
                 var vx = vars[i];
                 var q = from x in ind.Values where x.VariableId == vx.Id select x;
                 if (q.Count() > 0)
                 {
                     sval = StatHelpers.ConvertValue(q.First().DataStringValue);
                 }
                 line.Add(new DisplayItem(sval));
             }// i
             //
             oRet.Add(line);
         }// ind
     }
     catch (Exception /*ex */)
     {
         oRet = null;
     }
     return (oRet != null) ? new DisplayItemsArray(oRet) : null;
 }
Ejemplo n.º 31
0
 private String SetupDisplaySizeName()
 {
     return(CommonGlobalUtil.GetArrayString(DisplayItems?.ToArray(), SystemDefault.SPLIT_CHAR_COMMA));
 }
 public DisplayItemsArray ComputeCorrelationsDisplay(IEnumerable<VariableDesc> oVars)
 {
     var col = ComputeCorrelations(oVars);
     if (col == null)
     {
         return null;
     }
     DisplayItemsArray oRet = new DisplayItemsArray();
     DisplayItems hh = new DisplayItems();
     hh.Add(new DisplayItem("V1", true));
     hh.Add(new DisplayItem("V2", true));
     hh.Add(new DisplayItem("N", true));
     hh.Add(new DisplayItem("Prob.", true));
     hh.Add(new DisplayItem("Corr.", true));
     hh.Add(new DisplayItem("Min", true));
     hh.Add(new DisplayItem("Max", true));
     oRet.Add(hh);
     foreach (var c in col)
     {
         DisplayItems line = new DisplayItems();
         line.Add(new DisplayItem(c.FirstName));
         line.Add(new DisplayItem(c.SecondName));
         line.Add(new DisplayItem(c.Count));
         line.Add(new DisplayItem(c.Probability));
         line.Add(new DisplayItem(c.Value));
         line.Add(new DisplayItem(c.Minimum));
         line.Add(new DisplayItem(c.Maximum));
         oRet.Add(line);
     }// c
     return oRet;
 }
 }// RefreshPhotos
 public void refreshIndivs()
 {
     if (m_busy)
     {
         return;
     }
     m_busy = true;
     this.refreshVariables();
     var oRet = new List<IndivData>();
     var col = m_main.AllIndividus;
     DisplayItemsArray oDisp = new DisplayItemsArray();
     foreach (var ind in col)
     {
         int index = ind.IndivIndex;
         var vv = new IndivData(ind);
         oRet.Add(vv);
         DisplayItems dd = new DisplayItems();
         dd.Tag = vv;
         dd.Add(new DisplayItem(vv.IndivIndex));
         String sz = vv.IdString;
         dd.Add(new DisplayItem(sz));
         dd.Add(new DisplayItem(vv.Name));
         if ((vv.PhotoData != null) && (vv.PhotoData.Length > 1))
         {
             dd.Add(new DisplayItem(vv.PhotoData));
         }
         else
         {
             dd.Add(new DisplayItem());
         }
         oDisp.Add(dd);
     }// ind
     if (oRet.Count > 1)
     {
         oRet.Sort();
     }
     this.Individus = new IndivDatas(oRet);
     this.DisplayIndivs = oDisp;
     this.IsModified = false;
     m_busy = false;
     NotifyPropertyChanged("WorkDone");
 }// refreshIndivs
Ejemplo n.º 34
0
 public string GetValueFor(string key) => DisplayItems?.FirstOrDefault(d => d.Name == key)?.Value ?? string.Empty;
Ejemplo n.º 35
0
 }//RefreshArrangements 
 public Tuple<int[], DisplayItemsArray, PlotModel> CreateArrangeData(int nbIterations, CancellationToken cancellationToken)
 {
     var pDataModel = this;
     var inds = pDataModel.Individus;
     var vars = pDataModel.CurrentVariables.ToArray();
     int nv = vars.Length;
     int[] pRows = null;
     DisplayItemsArray oDisp = null;
     PlotModel model = null;
     try
     {
         var t1 = ArrangeSet.ArrangeIndex(pDataModel, nbIterations, cancellationToken);
         if (cancellationToken.IsCancellationRequested)
         {
             return new Tuple<int[], DisplayItemsArray, PlotModel>(pRows, oDisp, model);
         }
         pRows = t1.Item1;
         int[] pCols = t1.Item2;
         if ((pRows == null) || (pCols == null))
         {
             return new Tuple<int[], DisplayItemsArray, PlotModel>(pRows, oDisp, model);
         }
         if (pCols.Length < nv)
         {
             return new Tuple<int[], DisplayItemsArray, PlotModel>(pRows, oDisp, model);
         }
         double somme = 0.0;
         List<double> xdelta = new List<double>();
         List<double> xcum = new List<double>();
         oDisp = new DisplayItemsArray();
         DisplayItems header = new DisplayItems();
         header.Add(new DisplayItem("Pos.", true));
         header.Add(new DisplayItem("Index", true));
         header.Add(new DisplayItem("ID", true));
         header.Add(new DisplayItem("Nom", true));
         header.Add(new DisplayItem("Photo", true));
         for (int i = 0; i < nv; ++i)
         {
             int ii = pCols[i];
             if (ii >= nv)
             {
                 return new Tuple<int[], DisplayItemsArray, PlotModel>(pRows, oDisp, model);
             }
             String name = (vars[ii]).Name;
             header.Add(new DisplayItem(name, true));
         }// i
         oDisp.Add(header);
         IndivData firstIndiv = null;
         int nr = pRows.Length;
         for (int i = 0; i < nr; ++i)
         {
             int index = pRows[i];
             var q = from x in inds where x.IndivIndex == index select x;
             if (q.Count() > 0)
             {
                 var ind = q.First();
                 DisplayItems line = new DisplayItems();
                 line.Tag = ind;
                 line.Add(new DisplayItem(i + 1));
                 line.Add(new DisplayItem(ind.IndivIndex));
                 line.Add(new DisplayItem(ind.IdString));
                 line.Add(new DisplayItem(ind.Name));
                 if ((ind.PhotoData != null) && (ind.PhotoData.Length > 1))
                 {
                     line.Add(new DisplayItem(ind.PhotoData));
                 }
                 else
                 {
                     line.Add(new DisplayItem());
                 }
                 double[] dd = ind.DoubleData;
                 if ((dd != null) && (dd.Length >= nv))
                 {
                     for (int j = 0; j < nv; ++j)
                     {
                         int ii = pCols[j];
                         double xx = dd[ii];
                         line.Add(new DisplayItem(xx));
                     }// i
                 }// dd
                 oDisp.Add(line);
                 if (firstIndiv == null)
                 {
                     firstIndiv = ind;
                 }
                 else
                 {
                     double dx = ind.ComputeDistance(firstIndiv);
                     somme += dx;
                     xdelta.Add(dx);
                     xcum.Add(somme);
                     firstIndiv = ind;
                 }
             }// ok
         }// i
         if (somme > 0.0)
         {
             double[] ddx = xdelta.ToArray();
             double[] ddc = xcum.ToArray();
             int nx = ddx.Length;
             for (int i = 0; i < nx; ++i)
             {
                 ddx[i] = ddx[i] / somme;
                 ddc[i] = ddc[i] / somme;
             }// i
             double vmin = ddx.Min();
             double vmax = ddx.Max();
             if (vmin < vmax)
             {
                 double delta = vmax - vmin;
                 for (int i = 0; i < nx; ++i)
                 {
                     ddx[i] = (ddx[i] - vmin) / delta;
                 }// i
                 model = new PlotModel("Arrangements");
                 model.Axes.Add(new LinearAxis() { Title = "Position", Minimum = 0.0, Maximum = (double)(nx + 1), Position = AxisPosition.Bottom, FontWeight = FontWeights.Bold });
                 model.Axes.Add(new LinearAxis() { Title = "Distances", Minimum = ddx.Min(), Maximum = ddx.Max(), Position = AxisPosition.Left, FontWeight = FontWeights.Bold });
                 model.Axes.Add(new LinearAxis() { Title = "Position", Minimum = 0.0, Maximum = (double)(nx + 1), Position = AxisPosition.Top, FontWeight = FontWeights.Bold });
                 model.Axes.Add(new LinearAxis() { Title = "Cummul", Minimum = ddc.Min(), Maximum = ddc.Max(), Position = AxisPosition.Right, FontWeight = FontWeights.Bold });
                 var sx = new LineSeries { Title = "Distances", Smooth = true, FontWeight = FontWeights.Bold };
                 var sy = new LineSeries { Title = "Cummul", Smooth = true, FontWeight = FontWeights.Bold };
                 for (int i = 0; i < nx; ++i)
                 {
                     sx.Points.Add(new DataPoint((double)(i + 1), ddx[i]));
                     sy.Points.Add(new DataPoint((double)(i + 1), ddc[i]));
                 }// i
                 model.Series.Add(sx);
                 model.Series.Add(sy);
             }// graph
         }// someme
     }// try
     catch (Exception /* ex */)
     {
     }
     return new Tuple<int[], DisplayItemsArray, PlotModel>(pRows, oDisp, model);
 }//CreateArrangeDataAsync 
Ejemplo n.º 36
0
 }// RefreshShowPlotsAsync
 private DisplayItemsArray createOrdDisplayData()
 {
     List<DisplayItems> oRet = null;
     try
     {
         var inds = this.Individus.ToArray();
         int nr = inds.Length;
         if (nr < 1)
         {
             return null;
         }
         var pMan = this.DataService;
         if (pMan == null)
         {
             return null;
         }
         var allVars = m_main.Variables;
         VariableDesc idsvars = null;
         VariableDesc namesvars = null;
         VariableDesc photosvars = null;
         bool bString = true;
         foreach (var v in allVars)
         {
             if (v.IsIdVar)
             {
                 idsvars = v;
             }
             if (v.IsNameVar)
             {
                 namesvars = v;
             }
             if (v.IsImageVar)
             {
                 photosvars = v;
             }
         }// v
         if (photosvars != null)
         {
             String stype = photosvars.DataType.Trim().ToLower();
             if (!stype.Contains("string"))
             {
                 bString = false;
             }
         }// photovars
         var vars = this.CurrentVariables.ToArray();
         int nv = vars.Length;
         oRet = new List<DisplayItems>();
         DisplayItems header = new DisplayItems();
         header.Add(new DisplayItem("Num", true));
         header.Add(new DisplayItem("Index", true));
         header.Add(new DisplayItem("ID", true));
         header.Add(new DisplayItem("Nom", true));
         header.Add(new DisplayItem("Photo", true));
         //
         header.Add(new DisplayItem("CU", true));
         header.Add(new DisplayItem("KM", true));
         header.Add(new DisplayItem("HR", true));
         header.Add(new DisplayItem("AR", true));
         for (int i = 0; i < nv; ++i)
         {
             header.Add(new DisplayItem(vars[i].Name, true));
         }// i
         oRet.Add(header);
         for (int irow = 0; irow < nr; ++irow)
         {
             var ind = inds[irow];
             DisplayItems line = new DisplayItems();
             line.Tag = ind;
             line.Add(new DisplayItem(irow + 1));
             int index = ind.IndivIndex;
             line.Add(new DisplayItem(index));
             String sid = String.Empty;
             if (idsvars != null)
             {
                 var q = from x in ind.Values where x.VariableId == idsvars.Id select x;
                 if (q.Count() > 0)
                 {
                     sid = StatHelpers.ConvertValue(q.First().DataStringValue);
                 }
             }// idsvars
             line.Add(new DisplayItem(sid));
             String sname = String.Empty;
             if (namesvars != null)
             {
                 var q = from x in ind.Values where x.VariableId == namesvars.Id select x;
                 if (q.Count() > 0)
                 {
                     sname = StatHelpers.ConvertValue(q.First().DataStringValue);
                 }
             }// idsvars
             line.Add(new DisplayItem(sname));
             DisplayItem photo = new DisplayItem();
             if (photosvars != null)
             {
                 var q = from x in ind.Values where x.VariableId == photosvars.Id select x;
                 if (q.Count() > 0)
                 {
                     String sval = StatHelpers.ConvertValue(q.First().DataStringValue);
                     if (!String.IsNullOrEmpty(sval))
                     {
                         int nid = 0;
                         String name = null;
                         if (!bString)
                         {
                             double d = 0.0;
                             double.TryParse(sval, out d);
                             nid = (int)d;
                         }
                         else
                         {
                             name = sval;
                         }
                         PhotoDesc p = new PhotoDesc();
                         p.Id = nid;
                         p.Name = name;
                         var xx = pMan.FindPhoto(p);
                         if ((xx != null) && (xx.Item1 != null) && (xx.Item2 == null))
                         {
                             photo = new DisplayItem(xx.Item1.DataBytes);
                         }
                     }// sval
                 }
             }// photos
             line.Add(photo);
             //
             line.Add(new DisplayItem(ind.UtilityClusterIndex));
             line.Add(new DisplayItem(ind.KMeansClusterIndex));
             line.Add(new DisplayItem(ind.HierarClusterIndex));
             line.Add(new DisplayItem(ind.Position));
             //
             for (int i = 0; i < nv; ++i)
             {
                 String sval = String.Empty;
                 var vx = vars[i];
                 var q = from x in ind.Values where x.VariableId == vx.Id select x;
                 if (q.Count() > 0)
                 {
                     sval = StatHelpers.ConvertValue(q.First().DataStringValue);
                 }
                 line.Add(new DisplayItem(sval));
             }// i
             //
             oRet.Add(line);
         }// ind
     }
     catch (Exception /*ex */)
     {
         oRet = null;
     }
     return (oRet != null) ? new DisplayItemsArray(oRet) : null;
 }// createOrdDisplayData
Ejemplo n.º 37
0
 }// createOrdDisplayData
 private DisplayItemsArray createSortedDisplayData(int[] pRows, int[] pCols)
 {
     List<DisplayItems> oRet = null;
     try
     {
         var inds = this.SortedIndivs.ToArray();
         int nr = inds.Length;
         if (nr < 1)
         {
             return null;
         }
         oRet = new List<DisplayItems>();
         DisplayItems header = new DisplayItems();
         header.Add(new DisplayItem("Index", true));
         header.Add(new DisplayItem("ID", true));
         header.Add(new DisplayItem("Nom", true));
         header.Add(new DisplayItem("Photo", true));
         oRet.Add(header);
         for (int irow = 0; irow < nr; ++irow)
         {
             var ind = inds[irow];
             DisplayItems line = new DisplayItems();
             line.Tag = ind;
             line.Add(new DisplayItem(ind.IndivIndex));
             line.Add(new DisplayItem(ind.IdString));
             line.Add(new DisplayItem(ind.Name));
             if ((ind.PhotoData != null) && (ind.PhotoData.Length > 1))
             {
                 line.Add(new DisplayItem(ind.PhotoData));
             }
             else
             {
                 line.Add(new DisplayItem());
             }
             oRet.Add(line);
         }// ind
     }
     catch (Exception /*ex */)
     {
         oRet = null;
     }
     return (oRet != null) ? new DisplayItemsArray(oRet) : null;
 }// createOrdDisplayData
Ejemplo n.º 38
0
 }// getClusterSetData
 public DisplayItemsArray GetClustersData()
 {
     List<DisplayItems> oRet = new List<DisplayItems>();
     DisplayItems hh = new DisplayItems();
     hh.Add(new DisplayItem("Index", true));
     hh.Add(new DisplayItem("Nom", true));
     hh.Add(new DisplayItem("Taille", true));
     hh.Add(new DisplayItem("Var", true));
     hh.Add(new DisplayItem("Prop", true));
     var col = this.CurrentVariables.ToArray();
     int nc = col.Length;
     for (int i = 0; i < nc; ++i)
     {
         String name = (col[i]).Name;
         hh.Add(new DisplayItem(name, true));
     }//i
     oRet.Add(hh);
     var oSet1 = this.CategClusterSet;
     if (oSet1 != null)
     {
         var x = getClusterSetData(oSet1);
         if ((x != null) && (x.Count > 0))
         {
             oRet.AddRange(x);
         }
     }
     var oSet2 = this.KMeansClusterSet;
     if (oSet2 != null)
     {
         var x = getClusterSetData(oSet2);
         if ((x != null) && (x.Count > 0))
         {
             oRet.AddRange(x);
         }
     }
     var oSet3 = this.HierarClusterSet;
     if (oSet3 != null)
     {
         var x = getClusterSetData(oSet3);
         if ((x != null) && (x.Count > 0))
         {
             oRet.AddRange(x);
         }
     }
     return new DisplayItemsArray(oRet);
 }// GetClustersData
Ejemplo n.º 39
0
 }//getOrdDisplayDataAsync 
 private List<DisplayItems> getClusterSetData(CategClusterSet oSet)
 {
     List<DisplayItems> oRet = new List<DisplayItems>();
     if (oSet != null)
     {
         double somme = oSet.Variance;
         foreach (var c in oSet.Clusters)
         {
             DisplayItems line = new DisplayItems();
             line.Add(new DisplayItem(c.Index));
             line.Add(new DisplayItem(c.Name));
             line.Add(new DisplayItem(c.Count));
             double v = c.Variance;
             line.Add(new DisplayItem(v));
             if (somme > 0.0)
             {
                 line.Add(new DisplayItem(v / somme));
             }
             else
             {
                 line.Add(new DisplayItem());
             }
             double[] cx = c.Center;
             int nc = cx.Length;
             for (int i = 0; i < nc; ++i)
             {
                 line.Add(new DisplayItem(cx[i]));
             }// i
             oRet.Add(line);
         }// v
     }// oSet
     return oRet;
 }// getClusterSetData
Ejemplo n.º 40
0
        public void InitView()
        {
            Int32 idCommunity = View.PreloadIdCommunity;

            if (idCommunity < 0)
            {
                idCommunity = UserContext.CurrentCommunityID;
            }
            dtoModuleMessagesContext context = GetContext();

            View.ContainerContext = context;
            if (UserContext.isAnonymous)
            {
                SessionTimeout(idCommunity, View.PreloadSelectedTab);
            }
            else
            {
                DisplayTab tabs = View.PreloadTabs;
                DisplayTab tab  = View.PreloadSelectedTab;
                if (tabs == DisplayTab.None)
                {
                    tab = DisplayTab.Sent;
                }

                TemplateType type = View.PreloadTemplateType;
                if (type == TemplateType.None)
                {
                    type = TemplateType.Module;
                }

                SetCurrentItems(type, idCommunity, tab);
                LoadTabs(tabs, tab);

                Int32   idOtherModule = CurrentManager.GetModuleID(context.ModuleCode);
                Boolean otherModule   = (context.ModuleCode != ModuleTemplateMessages.UniqueCode);
                switch (tab)
                {
                case DisplayTab.List:
                case DisplayTab.Send:
                    View.GoToUrl(GetCurrentUrl(tab));
                    break;

                case DisplayTab.Sent:
                    View.InitializeFilterSelector(new List <DisplayItems>()
                    {
                        DisplayItems.ByRecipient, DisplayItems.ByMessage
                    }, DisplayItems.ByRecipient);
                    if (HasPermission(context))
                    {
                        DisplayItems displayBy = View.PreloadDisplayBy;
                        View.CurrentDisplayBy = displayBy;

                        if (MailService.HasMessages(context.ModuleObject))
                        {
                            switch (displayBy)
                            {
                            case DisplayItems.ByRecipient:
                                InitializeByRecipients(context);
                                break;

                            case DisplayItems.ByMessage:
                                IntializeByMessage(context);
                                break;
                            }
                        }
                        else
                        {
                            View.DisplayObjectWithNoMessage();
                        }
                    }
                    else
                    {
                        View.DisplayNoPermission(idCommunity, idOtherModule, context.ModuleCode);
                    }
                    break;

                default:
                    if (otherModule)
                    {
                        View.DisplayNoPermission(idCommunity, idOtherModule, context.ModuleCode);
                    }
                    else
                    {
                        View.DisplayNoPermission(idCommunity, Service.ServiceModuleID());
                    }
                    break;
                }
            }
        }
 }// CommitChanges
 #endregion // Methods
 #region Helpers
 private Tuple<int, DisplayItemsArray> refreshPhotosAsync(IStoreDataManager pMan)
 {
     DisplayItemsArray oRet = null;
     int nRet = 0;
     String s = this.SearchString;
     var xx = pMan.SearchPhotosCount(s);
     if ((xx != null) && (xx.Item2 == null))
     {
         nRet = xx.Item1;
     }
     var yy = pMan.SearchPhotos(s, this.Skip, this.Taken);
     if ((yy != null) && (yy.Item2 == null))
     {
         var col = yy.Item1;
         oRet = new DisplayItemsArray();
         foreach (var v in col)
         {
             DisplayItems vv = new DisplayItems();
             vv.Tag = v;
             vv.Add(new DisplayItem(v.DataBytes));
             vv.Add(new DisplayItem(v.Name));
             oRet.Add(vv);
         }// v
     }
     return new Tuple<int, DisplayItemsArray>(nRet, oRet);
 }// refreshPhotosAsync