public AddPage() { InitializeComponent(); button1.Content = new ImageButton(); button2.Content = new ImageButtonDelete(); _sampleA = new ListBoxMatrixItem(new MatrixView(2, 2, false) { MatrixName = "SampleA" }); _sampleB = new ListBoxMatrixItem(new MatrixView(3, 3, false) { MatrixName = "SampleB" }); _listboxMatrixItems = new List<ListBoxMatrixItem> {_sampleA, _sampleB}; if (IsolatedStorageSettings.ApplicationSettings.Contains("userData")) { List<PortableMatrix> matrixList = IsolatedStorageSettings.ApplicationSettings["userData"] as List<PortableMatrix>; if (matrixList != null) foreach (PortableMatrix matrix in matrixList) { MatrixLibrary.Matrix newMatrix = new MatrixLibrary.Matrix(matrix.ToTwoDimensionalArray(matrix.MatrixArray)); MatrixView mView = new MatrixView(newMatrix.NoCols, newMatrix.NoRows, false); mView.UpdateMatrix(newMatrix); mView.MatrixName = matrix.MatrixName; _listboxMatrixItems.Add(new ListBoxMatrixItem(mView)); } } listBox1.ItemsSource = _listboxMatrixItems; this.listBox1.SelectedItem = _sampleB; ApplicationBar = new ApplicationBar {IsVisible = true, Mode = ApplicationBarMode.Default, Opacity = 0.5}; ApplicationBarIconButton saveButton = new ApplicationBarIconButton(){IconUri = new Uri("/Image/save.png", UriKind.Relative), IsEnabled = true, Text = "Save"}; saveButton.Click += new EventHandler(SaveButtonClick); ApplicationBar.Buttons.Add(saveButton); }
private void Bbutton1Click(object sender, RoutedEventArgs e) { _vibrate.Start(TimeSpan.FromMilliseconds(10)); if (((PopupControl)_pop.Child).textBox1.Text == string.Empty) { ((PopupControl) _pop.Child).textBox1.Text = "Unamed Matrix"; } MatrixView matrix = new MatrixView(((PopupControl) _pop.Child).SelectedColumn, ((PopupControl) _pop.Child).SelectedRow, false) { MatrixName = ((PopupControl) _pop.Child).SelectedName }; ListBoxMatrixItem listboxmatrix = new ListBoxMatrixItem(matrix); _listboxMatrixItems.Add(listboxmatrix); listBox1.ItemsSource = null; listBox1.ItemsSource = _listboxMatrixItems; listBox1.SelectedItem = listboxmatrix; _pop.IsOpen = false; this.IsEnabled = true; }