private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if(periodicTableCanvas != null)
            {
                theCanvas = periodicTableCanvas;
                return;
            }
            for (int i = 0; i < PeriodicTable.elements.Count(); i++)
            {
                elementPanes[i] = new ElementPane(mode, i);
                theCanvas.Children.Add(elementPanes[i]);
                if (PeriodicTable.elements[i].type == ElementGroup.Lanthanide || PeriodicTable.elements[i].type == ElementGroup.Actinide)
                {
                    Canvas.SetTop(elementPanes[i], (PeriodicTable.elements[i].Period + 3) * elementPanes[i].Height);
                    Canvas.SetLeft(elementPanes[i], 20 + (((PeriodicTable.elements[i].AtomicNumber) - Element.periodProtonsRequired[PeriodicTable.elements[i].Period - 1]) - 1) * elementPanes[i].Width);
                }
                else
                {
                    Canvas.SetLeft(elementPanes[i], 20 + ((PeriodicTable.elements[i].Group - 1) * elementPanes[i].Width));
                    Canvas.SetTop(elementPanes[i], PeriodicTable.elements[i].Period * elementPanes[i].Height);
                }
                elementPanes[i].MouseLeftButtonUp += new MouseButtonEventHandler(ElePane_MouseUp);
            }
            if (mode == TableMode.information)
            {
                btnOkay.IsEnabled = false;
                btnCancel.Content = "Close";
                
            }
            periodicTableCanvas = theCanvas;
}
Exemplo n.º 2
0
 public static ElementPane[] panesSelected(TableMode modeT)
 {
     ElementPane[] elePanesT = new ElementPane[elementsSelected.Count()];
     for (int i = 0; i < elementsSelected.Count(); i++)
     {
         elePanesT[i] = new ElementPane(modeT,elementsSelected[i].AtomicNumber-1);
     }
     return elePanesT;
 }
 public ChangeEmpiricalPercentage(int indexT, decimal originalPercentageT)
 {
     originalPercentage = originalPercentageT;
     ElementPane paneTemp = new ElementPane(TableMode.display, indexT);
     paneTemp.Margin = new Thickness(10, 10, 0, 0);
     InitializeComponent();
     grid.Children.Add(paneTemp);
     Grid.SetColumn(paneTemp, 0);
     txtPercentage.Focus();
 }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < PeriodicTable.elements.Count(); i++)
            {
                elementPanes[i] = new ElementPane(mode, i);
                theCanvas.Children.Add(elementPanes[i]);
                Canvas.SetLeft(elementPanes[i], 20 + ((PeriodicTable.elements[i].Group - 1) * elementPanes[i].Width));
                Canvas.SetTop(elementPanes[i], PeriodicTable.elements[i].Period * elementPanes[i].Height);
                if (PeriodicTable.elements[i].type == ElementGroup.Lanthanide || PeriodicTable.elements[i].type == ElementGroup.Actinide)
                {
                    Canvas.SetTop(elementPanes[i], (PeriodicTable.elements[i].Period + 3) * elementPanes[i].Height);
                    Canvas.SetLeft(elementPanes[i], 20 + (((PeriodicTable.elements[i].AtomicNumber) - Element.periodProtonsRequired[PeriodicTable.elements[i].Period - 1]) - 1) * elementPanes[i].Width);
                }

            }
        }