示例#1
0
 public MainScreen()
 {
     AssertXmlFilesExist();
     AssertAlgFilesExist();
     SubsetFile       = new SubsetFile(subsetFilePath);
     XmlSubsetFile    = new XmlSubsetFile("subsets.xml");
     CustomSubsetFile = new CustomSubsetFile("customSubsets.xml");
     RecentSubsetFile = new RecentSubsetFile("recentSubsets.xml");
     InitializeComponent();
     Info.MainForm = this;
     StartPosition = FormStartPosition.CenterScreen;
     Update();
     //cube = new ZbllCube(PreviewCubeSize);
     foreach (var set1 in Enum.GetValues(typeof(AlgSet)).Cast <AlgSet>())
     {
         if (set1 != AlgSet.All)
         {
             AlgSetSelector.Items.Add(set1);
         }
     }
     AlgSetSelector.SelectedItem = AlgSet.ZBLL;
     Set    = AlgSet.ZBLL;
     Cube   = Info.GetCube(Set);
     PosNum = -1;
 }
示例#2
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     try
     {
         var setName = NameBox.Text;
         // make sure set name is not same as a predefined set name
         var defaultFile = new XmlSubsetFile("subsets.xml");
         var nameMap     = defaultFile.GetNameMap(Set);
         if (nameMap.ContainsKey(setName))
         {
             throw new ArgumentException($"Subset name '{setName}' already exists");
         }
         CustomSubsetFile file = new CustomSubsetFile("customSubsets.xml");
         var rawText           = AlgListBox.Text;
         var newSet            = new CustomSubset(setName, rawText, Set);
         SubsetTools.ValidateAlgListInput(rawText, nameMap, Info.GetNumPositionsInSet(Set));
         file.AddSubset(newSet);
         MessageBox.Show("subset added", "success", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#3
0
        public SubsetListScreen(AlgSet set)
        {
            StartPosition = FormStartPosition.CenterScreen;
            InitializeComponent();
            Set = set;
            int startX = 50;
            int startY = 80;
            int currY  = startY;


            File = new CustomSubsetFile("customSubsets.xml");
            var subsets = File.GetSubsets(Set);

            var originalFile = SubsetTools.GetXmlSubsetFile();
            var nameMap      = originalFile.GetNameMap(Set);

            for (int k = 0; k < subsets.Count; k++)
            {
                var control = new SubsetListEntry(subsets[k], File, nameMap)
                {
                    Location = new Point(startX, currY)
                };
                currY += HeightPerRow;
                this.Controls.Add(control);
            }
            this.AutoScroll = true;
        }
示例#4
0
 public SubsetListEntry(CustomSubset customSubset, CustomSubsetFile file, Dictionary <string, List <int> > nameMap)
 {
     InitializeComponent();
     CustomSubset         = customSubset;
     File                 = file;
     NameMap              = nameMap;
     SubsetNameLabel.Text = CustomSubset.Name;
     RangeListBox.Text    = customSubset.RangeStr;
 }