private void UpdateDataView() { if (ddlGroups.SelectedIndex > 0) { panelExplain.Visible = false; dg.Visible = true; using (inputForm = InputForm.GetByKey(inputFormId)) { //ContainerList cl = Container.GetAll("GroupId = " + ddlGroups.SelectedValue); using (ContainerList cl = inputForm.GetCandidates(Convert.ToInt32(ddlGroups.SelectedValue))) { cl.Sort("Tag"); dg.DataSource = cl; dg.DataBind(); Utils.InitGridSort(ref dg, false); dg.DisplayLayout.Pager.AllowPaging = false; dg.DisplayLayout.AllowSortingDefault = Infragistics.WebUI.UltraWebGrid.AllowSorting.No; lbNbContainers.Text = " (#" + cl.Count.ToString() + " containers with [" + inputForm.InputFormTypeCode + "] type)"; } if (ifcl != null) { ifcl.Dispose(); } } } else { dg.Visible = false; panelExplain.Visible = true; } }
private GroupingReadOnlyObservableListSource(IEnumerable <TSource> source, Func <TSource, IObservable <TKey> > keySelector, IEqualityComparer <TKey> keyComparer, IEqualityComparer <TSource> sourceComparer, ObservableCollection <ReadOnlyObservableGroup <TSource, TKey> > groups) : base(groups) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (keySelector == null) { throw new ArgumentNullException(nameof(keySelector)); } _keySelector = keySelector; _keyComparer = keyComparer ?? EqualityComparer <TKey> .Default; _sourceComparer = new ContainerEqualityComparer <TSource, GroupedItemContainer <TSource, TKey> >(sourceComparer); var initialContainers = source.Select(i => new GroupedItemContainer <TSource, TKey>(i, _keySelector, _keyComparer)); _containers = new ContainerList(this, initialContainers, _keyComparer, groups); _source = source as INotifyCollectionChanged; if (_source != null) { CollectionChangedEventManager.AddListener(_source, this); } }
//PSB =================================================================================================================== public void Sociedad() { //aarb //inicializar botones //indicador de sociedad activa GameObject ImgSocActiva = GameObject.Find("ImgSocActiva"); for (int i = 0; i < cantSociedades; i++) { //para cada uno de los botones de las sociedades int iterador = i; //colocar color al boton GameObject.Find("BtnSoc" + iterador).GetComponent <Image>().color = SociedadDict[iterador].GetColor(); //listener boton seleccion de sociedad GameObject.Find("BtnSoc" + iterador).GetComponent <Button>().onClick.AddListener(() => { tablero.socGeneral = iterador; print(tablero.socGeneral); //asignar color de sociedad activa BtnSocList.GetComponent <Image>().color = SociedadDict[iterador].GetColor(); //cerrar panel al seleccionar una sociedad ContainerList.GetComponent <CanvasGroup>().alpha = 0; ContainerList.SetActive(false); panel.GetComponent <CanvasGroup>().alpha = 0; panel.SetActive(false); }); } }//fSociedad
protected void UpdateDataEdit(string selContainerTypeCode) { if ((selContainerTypeCode == null) || (selContainerTypeCode.Length == 0)) { selContainerTypeCode = " "; } ContainerType containerType = ContainerType.GetByKey(Convert.ToChar(selContainerTypeCode)); if (containerType == null) { webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./ContainerTypes/containertype_properties.aspx?d="; lbTitle.Text = "Container type: New"; webTab.Tabs.GetTab(1).Visible = false; } else { webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./ContainerTypes/containertype_properties.aspx?d=" + selContainerTypeCode; webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./ContainerTypes/containertype_containers.aspx?d=" + selContainerTypeCode; string sqlFilter = " ContainerTypeCode = '" + containerType.Code + "'"; using (ContainerList c = HyperCatalog.Business.Container.GetAll(sqlFilter)) { webTab.Tabs.GetTab(1).Text = "Containers (" + c.Count + ")"; } webTab.Tabs.GetTab(1).Visible = true; lbTitle.Text = "Container type: " + containerType.Name; } panelGrid.Visible = false; webTab.Visible = true; }
private void InsertAddedItems(NotifyCollectionChangedEventArgs e) { if (e.NewItems != null) { int index = e.NewStartingIndex; int nextItemIndex = index; if (!HasChildren) { //first child, should be in the treeitem place nextItemIndex = -1; } else if (index == 0) { nextItemIndex = -1; } else if (index == Children.Count) { nextItemIndex = ContainerList.IndexOf(this) + CountVisibleDescendatns(); } else { var nextItem = Children[index]; nextItemIndex = ContainerList.IndexOf(nextItem) - 1; } var newChildren = new List <LiteTreeViewItemViewModel>(); foreach (object obj in e.NewItems) { newChildren.Add(AddChild(obj, index)); index++; } FillTreeList(ContainerList, newChildren, ref nextItemIndex); } }
protected void UpdateDataEdit(string selDataType) { if (selDataType == string.Empty) { webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./datatypes/datatype_properties.aspx?d="; lbTitle.Text = "Report: New"; webTab.Tabs.GetTab(1).Visible = false; panelGrid.Visible = false; webTab.Visible = true; } else { DataType dataType = DataType.GetByKey(Convert.ToChar(selDataType)); if (dataType != null) { webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./datatypes/datatype_properties.aspx?d=" + selDataType; webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./datatypes/datatype_containers.aspx?d=" + selDataType; string sqlFilter = " DataTypeCode = '" + selDataType + "'"; using (ContainerList c = HyperCatalog.Business.Container.GetAll(sqlFilter)) { webTab.Tabs.GetTab(1).Text = "Containers (" + c.Count + ")"; webTab.Tabs.GetTab(1).Visible = true; lbTitle.Text = "DataType: " + dataType.Name; } panelGrid.Visible = false; webTab.Visible = true; } } }
private void Listeners() //cambiado //Boton para activar panel de filtros de sociedades //boton para activar panel de lista de sociedades { BtnSocList.GetComponent <Button>().onClick.AddListener(() => { panel.SetActive(true); panel.GetComponent <CanvasGroup>().alpha = 1; ContainerList.SetActive(true); ContainerList.GetComponent <CanvasGroup>().alpha = 1; //cuando se abre el panel ver si se limpio el tablero y restaurar los togles if (GameObject.Find("Inventory").GetComponent <Inventory>().cleared) { RestoreFilters(); GameObject.Find("Inventory").GetComponent <Inventory>().cleared = false; } //titulo TextPanelSociedad.text = "Selecciona una sociedad"; }); //boton para cerrar panel btnCerrar.GetComponent <Button>().onClick.AddListener(() => { ContainerList.GetComponent <CanvasGroup>().alpha = 0; ContainerList.SetActive(false); panel.GetComponent <CanvasGroup>().alpha = 0; //PSB foreach (Transform item in GameObject.Find("ContainerText").transform) { item.GetComponent <SociedadEditar>().DefaultMode(); } //PSB panel.SetActive(false); }); Filtros(); Sociedad(); }
/// <summary> /// Display the selected term properties /// </summary> /// <param name="selTermId">TermId</param> void UpdateDataEdit(string selTermId) { Session["PageIndexTerm"] = dg.DisplayLayout.Pager.CurrentPageIndex; Session["TermType"] = DDL_TermTypeList.SelectedValue; Session["FilterTerm"] = txtFilter.Text; panelGrid.Visible = false; webTab.EnableViewState = false; webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./Termbase/Term_Properties.aspx?t=" + selTermId; if (selTermId == "-1") { #region New Term webTab.Tabs.GetTab(1).ContentPane.TargetUrl = ""; webTab.Tabs[1].Visible = false; webTab.Tabs.GetTab(2).ContentPane.TargetUrl = ""; webTab.Tabs[2].Visible = false; lbTitle.Text = "Term: New"; #endregion } else { #region Term selected using (Term HCTerm = Term.GetByKey(Convert.ToInt32(selTermId))) { string termValue = HCTerm.Value.ToString(); if (termValue.Length > 50) { termValue = termValue.Substring(0, 50) + "..."; } lbTitle.Text = "Term: " + termValue; webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./Termbase/Term_Translations.aspx?t=" + selTermId; webTab.Tabs.GetTab(2).ContentPane.TargetUrl = "./Termbase/Term_Containers.aspx?t=" + selTermId; HyperComponents.Data.dbAccess.Database dbObj = new HyperComponents.Data.dbAccess.Database(SessionState.CacheComponents["Crystal_DB"].ConnectionString); #region Translations Count TermTranslationList tlist; int TranslationsCount; using (tlist = TermTranslation.GetAll(Convert.ToInt32(selTermId), "TermTypeCode='" + HCTerm.TermTypeCode + "'")) { TranslationsCount = tlist.Count - HCTerm.TranslationsMissingCount; } #endregion webTab.Tabs.GetTab(1).Text = "Translations (" + TranslationsCount.ToString() + "/" + tlist.Count.ToString() + ")"; #region Containers Count webTab.Tabs.GetTab(2).Visible = false; using (ContainerList clist = HyperCatalog.Business.Container.GetAll("LabelId=" + selTermId)) { if (clist.Count > 0) { webTab.Tabs.GetTab(2).Text = "Containers (" + clist.Count + ")"; webTab.Tabs.GetTab(2).Visible = true; } } #endregion } #endregion } panelTabTerm.Visible = true; webTab.SelectedTabIndex = 0; }
private void AddContainerToList(CloudBlobContainer container) { if (!ContainerList.Any(x => x.Name.Equals(container.Name))) { Log.Info($"adding container to list:{container.Name}", ConsoleColor.Green); ContainerList.Add(container); } }
public static void NewConnections(string filename) { try { ConnectionList = new ConnectionList(); ContainerList = new ContainerList(); ConnectionsLoader connectionsLoader = new ConnectionsLoader(); if (filename == GetDefaultStartupConnectionFileName()) { Settings.Default.LoadConsFromCustomLocation = false; } else { Settings.Default.LoadConsFromCustomLocation = true; Settings.Default.CustomConsPath = filename; } var dirname = GetDirectoryName(filename); if (dirname != null) { Directory.CreateDirectory(dirname); } // Use File.Open with FileMode.CreateNew so that we don't overwrite an existing file using (FileStream fileStream = File.Open(filename, FileMode.CreateNew, FileAccess.Write, FileShare.None)) { using (XmlTextWriter xmlTextWriter = new XmlTextWriter(fileStream, System.Text.Encoding.UTF8)) { xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.Indentation = 4; xmlTextWriter.WriteStartDocument(); xmlTextWriter.WriteStartElement("Connections"); // Do not localize xmlTextWriter.WriteAttributeString("Name", Language.strConnections); xmlTextWriter.WriteAttributeString("Export", "", "False"); xmlTextWriter.WriteAttributeString("Protected", "", "GiUis20DIbnYzWPcdaQKfjE2H5jh//L5v4RGrJMGNXuIq2CttB/d/BxaBP2LwRhY"); xmlTextWriter.WriteAttributeString("ConfVersion", "", "2.5"); xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndDocument(); xmlTextWriter.Close(); } } connectionsLoader.ConnectionList = ConnectionList; connectionsLoader.ContainerList = ContainerList; ConnectionTree.ResetTree(); connectionsLoader.RootTreeNode = Windows.treeForm.tvConnections.Nodes[0]; // Load config connectionsLoader.ConnectionFileName = filename; connectionsLoader.LoadConnections(false); Windows.treeForm.tvConnections.SelectedNode = connectionsLoader.RootTreeNode; } catch (Exception ex) { MessageCollector.AddExceptionMessage(Language.strCouldNotCreateNewConnectionsFile, ex); } }
/// <summary> /// Show the list of containers depending of the selected term /// </summary> private void ShowTermContainers() { using (ContainerList list = HyperCatalog.Business.Container.GetAll("LabelId=" + termId)) { dg.DataSource = list; Utils.InitGridSort(ref dg); dg.DataBind(); } }
private void InnerAdd <TFact>(TFact fact, IEqualityComparer <IFact> comparer) where TFact : IFact { IFactType factType = fact.GetFactType(); if (ContainerList.Contains(fact, comparer)) { throw CommonHelper.CreateException(ErrorCode.InvalidData, $"The fact container already contains '{factType.FactName}' fact."); } ContainerList.Add(fact); }
/// <summary> /// Delete container /// </summary> /// <param name="container">A cloudblobcontainer object</param> /// <param name="accessCondition">Access condition</param> /// <param name="options">Blob request option</param> /// <param name="operationContext">Operation context</param> public void DeleteContainer(CloudBlobContainer container, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext) { foreach (CloudBlobContainer containerRef in ContainerList) { if (container.Name == containerRef.Name) { ContainerList.Remove(containerRef); return; } } }
public static void SetContainer(ContainerList containerName, GameObject container) { switch (containerName) { case ContainerList.Bullet: Bullets = container; break; case ContainerList.Bodies: Bodies = container; break; } }
/// <summary> /// Resolve the <see cref="ContainerList{T}"/> from a <see cref="IEnumerable{Guid}"/> that represent the ids of the contained <see cref="Thing"/>s /// </summary> /// <typeparam name="T">The type of <see cref="Thing"/></typeparam> /// <param name="list">The <see cref="ContainerList{T}"/> to resolve</param> /// <param name="guidList">The source <see cref="IEnumerable{Guid}"/></param> /// <param name="iterationId">The potential <see cref="Iteration"/> container id of the contained <see cref="Thing"/>s</param> /// <param name="cache">The cache that stores the <see cref="Thing"/>s</param> internal static void ResolveList <T>(this ContainerList <T> list, IEnumerable <Guid> guidList, Guid?iterationId, ConcurrentDictionary <CacheKey, Lazy <CommonData.Thing> > cache) where T : Thing { list.Clear(); foreach (var guid in guidList) { if (cache.TryGet(guid, iterationId, out T thing)) { thing.ChangeKind = ChangeKind.None; list.Add(thing); } } }
void RemoveChild(object child) { var treeItem = _itemsToTreeItems[child]; treeItem.RemoveFromTreeList(false); Children.Remove(treeItem); _itemsToTreeItems.Remove(child); _treeItemsToItems.Remove(treeItem); if (IsOpen) { ContainerList.Remove(treeItem); } treeItem.Dispose(); }
/// <summary> /// Create the container if not exists /// </summary> /// <param name="container">A cloudblobcontainer object</param> /// <param name="options">Blob request option</param> /// <param name="operationContext">Operation context</param> /// <returns>True if the container did not already exist and was created; otherwise false.</returns> public bool CreateContainerIfNotExists(CloudBlobContainer container, BlobRequestOptions requestOptions = null, OperationContext operationContext = null) { CloudBlobContainer containerRef = GetContainerReference(container.Name); if (DoesContainerExist(containerRef, requestOptions, operationContext)) { return(false); } else { containerRef = GetContainerReference(container.Name); ContainerList.Add(containerRef); return(true); } }
public void RemoveFromTreeList(bool isRoot = true) { if (HasChildren) { if (IsOpen || isRoot) { //var myIndex = ContainerList.IndexOf(this); //ContainerList.RemoveRange(myIndex+1,CountVisibleDescendatns()); foreach (var child in Children) { ContainerList.Remove(child); child.RemoveFromTreeList(false); } } } }
/// <summary>Get the current List of HC_ and load if necessary.</summary> private static CollectionView GetContainers() { Cache c = HttpRuntime.Cache; CollectionView view = (CollectionView)c[CACHEENTRYNAME]; if (view == null) { using (ContainerList containers = HyperCatalog.Business.Container.GetAll()) { view = new CollectionView(containers); view.ApplySort("Tag", System.ComponentModel.ListSortDirection.Ascending); c.Insert(CACHEENTRYNAME, view, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(30), CacheItemPriority.High, null); } } // if return(view); } // Load
private void UpdateDataView() { lbError.Visible = false; string filter = string.Empty; filter += " ContainerTypeCode='T'"; filter += " AND Id NOT IN (SELECT TechspecContainerId FROM ContainerDependencies WHERE FeatureContainerId=" + featureContainerId + ")"; filter += " ORDER BY Tag"; using (ContainerList containers = HyperCatalog.Business.Container.GetAll(filter)) { ddlTechspecContainers.DataSource = containers; ddlTechspecContainers.DataTextField = "Tag"; ddlTechspecContainers.DataValueField = "Id"; ddlTechspecContainers.DataBind(); } }
/// <inheritdoc/> public virtual bool TryGetFact <TFact>(out TFact fact) where TFact : IFact { var destFactType = GetFactType <TFact>(); IFact innerFact = ContainerList .Where(f => f.GetFactType().EqualsFactType(destFactType)) .OrderByDescending(f => f, Comparer ?? Comparer <IFact> .Create((x, y) => x.CompareTo(y))) .FirstOrDefault(); if (innerFact == null) { fact = default; return(false); } else { fact = (TFact)innerFact; return(true); } }
private void button1_Click_1(object sender, EventArgs e) { Parser p = new Parser(); ContainerList container = new ContainerList(); for (int i = 0; i < listOfFiles.Count; i++) { container.list.Add(p.readFile(listOfFiles.ElementAt(i).FullName)); } // for (int i=0; i< ) //List<string> list = new List<string>(); /// int size = list.Count; MyCustomForm f = new MyCustomForm(); f.Show(); // string[] filenames = Directory.GetFiles(PathSettings.localPath) // TabPage[] tabs = new TabPage[size]; }
public void LoadContainersPlacement(string FileName) { XDocument xml = XDocument.Load(FileName); xml.Descendants("Bay").Select(x => new { Name = x.Attribute("Name").Value, Containers = x.Descendants("Container").Select(c => new { Row = Convert.ToInt16(c.Attribute("Row").Value), Tier = Convert.ToInt16(c.Attribute("Tier").Value), Loaded = Convert.ToBoolean(c.Attribute("Loaded").Value) }) }).ToList().ForEach(d => { foreach (var item in d.Containers) { ContainerObject container = ContainerList.Find(i => i.BayNumberString == d.Name && i.Row == item.Row && i.Tier == item.Tier); container.containerLoaded = item.Loaded; } }); }
private void AddContainerToList(TreeNode tNode) { var contI = new ContainerInfo { TreeNode = tNode, Name = Convert.ToString(_sqlDataReader["Name"]) }; var conI = GetConnectionInfoFromSql(); conI.Parent = contI; conI.IsContainer = true; contI.CopyFrom(conI); if (DatabaseUpdate) { var prevCont = PreviousContainerList.FindByConstantID(conI.ConstantID); if (prevCont != null) { contI.IsExpanded = prevCont.IsExpanded; } if (conI.ConstantID == PreviousSelected) { _selectedTreeNode = tNode; } } else { contI.IsExpanded = Convert.ToBoolean(_sqlDataReader["Expanded"]); } ContainerList.Add(contI); ConnectionList.Add(conI); tNode.Tag = contI; tNode.ImageIndex = (int)TreeImageType.Container; tNode.SelectedImageIndex = (int)TreeImageType.Container; }
// Use this for initialization void Start() { Sociedades = new Dictionary <int, List <string> >(); //PSB inicializo el diccionario de las sociedades SociedadDict = new Dictionary <int, Sociedad>(); SociedadDict.Add(0, new Sociedad(new Color(1f, 1f, 1f, 1.00f), "Sociedad 0")); SociedadDict.Add(1, new Sociedad(new Color(0.06666667f, 0.6392157f, 0.8470588f, 1f), "Sociedad 1")); SociedadDict.Add(2, new Sociedad(new Color(0.6351443f, 0.2834639f, 0.9245283f, 1f), "Sociedad 2")); SociedadDict.Add(3, new Sociedad(new Color(0.9960784f, 0.9490196f, 0.3058824f, 1.00f), "Sociedad 3")); SociedadDict.Add(4, new Sociedad(new Color(0, 1f, 0.5382376f, 1f), "Sociedad 4")); SociedadDict.Add(5, new Sociedad(new Color(1f, 0.4537815f, 0f, 1f), "Sociedad 5")); tablero = GameObject.Find("Tablero").GetComponent <ControllerBoard>(); panel = GameObject.Find("PanelFiltrosSociedades"); btnCerrar = GameObject.Find("BtnCerrarPanelFilSoc"); btnFilSoc = GameObject.Find("BtnFilSoc"); BtnSocList = GameObject.Find("BtnSocList"); ContainerList = GameObject.Find("ContainerList"); TextPanelSociedad = GameObject.Find("TextPanelSociedad").GetComponent <Text>(); //cantidad de sociedades cantSociedades = 6; IniDicAct(); //crear una lista para saber cuales elementos se han quitado del mapa listaOcultados = new List <Piece>(); //listeners de botones Listeners(); //ocultar panel ContainerList.GetComponent <CanvasGroup>().alpha = 0; ContainerList.SetActive(false); panel.GetComponent <CanvasGroup>().alpha = 0; panel.SetActive(false); }
/// <summary> /// Show Term /// </summary> private void ShowTerm() { #region Load TermType list using (TermTypeList TermTypes = TermType.GetAll()) { DDL_TermTypeList.DataSource = TermTypes; DDL_TermTypeList.DataBind(); } #endregion if (t != null) { #region Retrieve information about the current container txtTermValue.Text = t.Value.ToString(); using (ContainerList clist = HyperCatalog.Business.Container.GetAll("LabelId=" + termId)) { if (clist.Count != 0) { txtTermValue.Enabled = false; } else { txtTermValue.Enabled = true; } txtComment.Text = t.Comment.ToString(); //ACQ8.20 Ends if (t.TermTypeCode.ToString() == "S") { IsTranslatable.Enabled = false; } IsTranslatable.Checked = t.IsTranslatable; //ACQ8.20 Ends lUsage.Text = "Used " + t.UsageCount.ToString() + " time(s)"; DDL_TermTypeList.SelectedValue = t.TermTypeCode.ToString(); DDL_TermTypeList.Enabled = false; hlCreator.Text = UITools.GetDisplayName(t.User.FullName); hlCreator.NavigateUrl = "mailto:" + UITools.GetDisplayEmail(t.User.Email) + Server.HtmlEncode("?subject=Term[#" + t.Id.ToString() + "]");; lbOrganization.Text = t.User.OrgName; lbOrganization.Visible = hlCreator.Text == t.User.FullName; lbCreatedOn.Text = SessionState.User.FormatUtcDate(t.ModifyDate.Value, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime); UITools.ShowToolBarButton(uwToolbar, "Delete"); UITools.ShowToolBarSeparator(uwToolbar, "SepDelete"); } using (Database dbObj = Utils.GetMainDB()) { using (DataSet ds = dbObj.RunSQLReturnDataSet("dbo.[_Term_GetAssociatedInputForms] " + t.Id.ToString())) { dbObj.CloseConnection(); if (ds.Tables[0].Rows.Count > 0) { dg.DataSource = ds; dg.DataBind(); fUsage.Visible = true; } else { fUsage.Visible = false; } } } #endregion } else { #region New Term DDL_TermTypeList.Enabled = true; hlCreator.Text = SessionState.User.FullName; hlCreator.NavigateUrl = "mailto:" + UITools.GetDisplayEmail(SessionState.User.Email) + Server.HtmlEncode("?subject=TMExpression");; lbOrganization.Text = SessionState.User.OrgName; lbCreatedOn.Text = SessionState.User.FormatUtcDate(DateTime.Now, true, SessionState.User.FormatDate + ' ' + SessionState.User.FormatTime); fUsage.Visible = false; UITools.HideToolBarButton(uwToolbar, "Delete"); UITools.HideToolBarSeparator(uwToolbar, "SepDelete"); #endregion } }
public Container <T> GetLast(ContainerList <Container <T> > list) { return(list[list.Count - 1]); }
// // Constructors // public CollisionSubscription() : base() { this.listOfSubscribers = new ContainerList(); this.collisionName = CollisionPairEvaluator.Name.UNINITIALIZED; }
public void Setup() { this.person = new Person(Guid.NewGuid(), null, null); this.emailAddresses = new ContainerList <EmailAddress>(this.person); }
private void fi_solve() { List <Tuple <Constant, Constant, Constant> >[] possiblePairs = new List <Tuple <Constant, Constant, Constant> > [3]; for (int i = 0; i < possiblePairs.Length; i++) { possiblePairs[i] = new List <Tuple <Constant, Constant, Constant> >(); } ContainerList[] hor = new ContainerList[3]; for (int i = 0; i < 3; i++) { hor[i] = AContainer.Read($"{(char)(65 + 0 + 3 * i)}{mi_hOperators[i, 0]}{(char)(65 + 1 + 3 * i)}{mi_hOperators[i, 1]}{(char)(65 + 2 + 3 * i)}"); } double value; Constant c1, c2, c3; for (int first = 0; first < 10; first++) { for (int second = 0; second < 10; second++) { for (int third = 0; third < 10; third++) { for (int cl = 0; cl < hor.Length; cl++) { c1 = new Constant(((char)(65 + 0 + 3 * cl)).ToString(), first); c2 = new Constant(((char)(65 + 1 + 3 * cl)).ToString(), second); c3 = new Constant(((char)(65 + 2 + 3 * cl)).ToString(), third); hor[cl].SetConstants(c1); hor[cl].SetConstants(c2); hor[cl].SetConstants(c3); value = ((ContainerList)hor[cl].Clone()).Calculate(); if ((int)value == mi_hResults[cl]) { possiblePairs[cl].Add(new Tuple <Constant, Constant, Constant>(c1, c2, c3)); } } } } } ContainerList[] ver = new ContainerList[3]; int[] values = new int[3]; for (int i = 0; i < 3; i++) { string text = $"{(char)(65 + i + 3 * 0)}{mi_vOperators[i, 0]}{(char)(65 + i + 3 * 1)}{mi_vOperators[i, 1]}{(char)(65 + i + 3 * 2)}"; ver[i] = AContainer.Read(text); } for (int first = 0; first < possiblePairs[0].Count; first++) { for (int i = 0; i < 3; i++) { ver[i].SetConstants(possiblePairs[0][first].Item1, possiblePairs[0][first].Item2, possiblePairs[0][first].Item3); } for (int second = 0; second < possiblePairs[1].Count; second++) { for (int i = 0; i < 3; i++) { ver[i].SetConstants(possiblePairs[1][second].Item1, possiblePairs[1][second].Item2, possiblePairs[1][second].Item3); } for (int third = 0; third < possiblePairs[2].Count; third++) { for (int i = 0; i < 3; i++) { ver[i].SetConstants(possiblePairs[2][third].Item1, possiblePairs[2][third].Item2, possiblePairs[2][third].Item3); values[i] = (int)((ContainerList)ver[i].Clone()).Calculate(); } if (values[0] == mi_vResults[0] && (values[1] == mi_vResults[1]) && (values[2] == mi_vResults[2])) { mi_operants[0, 0] = (int)possiblePairs[0][first].Item1.mu_value; mi_operants[0, 1] = (int)possiblePairs[0][first].Item2.mu_value; mi_operants[0, 2] = (int)possiblePairs[0][first].Item3.mu_value; mi_operants[1, 0] = (int)possiblePairs[1][second].Item1.mu_value; mi_operants[1, 1] = (int)possiblePairs[1][second].Item2.mu_value; mi_operants[1, 2] = (int)possiblePairs[1][second].Item3.mu_value; mi_operants[2, 0] = (int)possiblePairs[2][third].Item1.mu_value; mi_operants[2, 1] = (int)possiblePairs[2][third].Item2.mu_value; mi_operants[2, 2] = (int)possiblePairs[2][third].Item3.mu_value; fi_updateOperants(); return; } } } } MessageBox.Show("there is no valid solution", "caution"); }