Exemple #1
0
 public NodeType(string name, ExperimentNode m, string description)
 {
     Name               = name;
     Member             = m;
     Description        = description;
     Member.Description = description;
 }
        public void Delete_Card_Click(object sender, RoutedEventArgs e)
        {
            Button         tar    = (Button)sender;
            ExperimentNode remove = (ExperimentNode)tar.Tag;
            ListView       list   = (ListView)FindName(remove.Category.Replace(" ", "") + "Cards");

            list.Items.Remove(remove);
            Exp.RemoveNode(remove);
            Exp.Save();
        }
        public async void Create_New_Card(object sender, RoutedEventArgs e)
        {
            ExperimentNode obj = ((MenuFlyoutItem)sender).Tag as ExperimentNode;
            string         sel = ((PivotItem)RootPivot.SelectedItem).Header as string;

            if (obj.GetType() == typeof(DataChartNode))
            {
                DataChartNode       chart = ((DataChartNode)obj);
                List <VariableNode> dVars = Exp.GetVariables(VariableNode.VariableType.Dependent);
                List <VariableNode> iVars = Exp.GetVariables(VariableNode.VariableType.Independent);

                string title = "";
                if (dVars.Count > 0 && iVars.Count > 0)
                {
                    ChartVariable chartDialog = new ChartVariable(dVars, iVars);
                    var           result      = await chartDialog.ShowAsync();

                    if (result == ContentDialogResult.Primary)
                    {
                        int iD = chartDialog.iD;
                        int iI = chartDialog.iI;
                        title = iVars[iI].Measurement_Name + " (" + iVars[iI].Unit_Name + ") vs " +
                                dVars[iD].Measurement_Name + " (" + dVars[iD].Unit_Name + ")";
                        chart.Independent = iVars[iI];
                        chart.Dependent   = dVars[iD];
                        chart.Title       = title;
                        ListView list = (ListView)FindName(sel.Replace(" ", "") + "Cards");
                        list.Items.Add(obj);
                        Exp.AddNode(obj);
                        Exp.Save();
                    }
                }
                else
                {
                    ContentDialog dialog = new ContentDialog()
                    {
                        Title   = "Please specify experiment variables",
                        Content = "To create a chart, experiment variables must be created in" +
                                  "the Problem Tab.  Go to the tab and specify at least one Independent and " +
                                  "Dependent Variable.",
                        PrimaryButtonText = "OK"
                    };
                    await dialog.ShowAsync();
                }
            }
            else
            {
                Exp.AddNode(obj);
                ListView list = (ListView)FindName(sel.Replace(" ", "") + "Cards");
                list.Items.Add(obj);
                Exp.Save();
            }
        }
Exemple #4
0
 public void RemoveNode(ExperimentNode deleteNode)
 {
     Cards.Remove(deleteNode);
 }
Exemple #5
0
 public void AddNode(ExperimentNode newNode)
 {
     Cards.Add(newNode);
 }