示例#1
0
        private void MenuItem_Edit_MatrixDimensions_Click(object sender, RoutedEventArgs e)
        {
            MatrixDimensions md = new MatrixDimensions
            {
                Owner = this,
                WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner
            };

            md.ShowDialog();
        }
示例#2
0
        private static int[] GetMatrixDefinition()
        {
            byte[] b = { 0x05 };
            string width = "", height = "";

            int[] data = new int[2];
            try
            {
                _sp.Write(b, 0, 1);
                width  = _sp.ReadLine();
                height = _sp.ReadLine();

                width  = Regex.Replace(width, "[^0-9]", "");
                height = Regex.Replace(height, "[^0-9]", "");
            }
            catch (Exception)
            {
                //MessageBox.Show("Application cannot parse matrix width/height definition");
                //This is kinda a hacky way of adding this feature...
                MatrixDimensions md = new MatrixDimensions();
                md.ShowDialog();
                data[0] = MatrixFrame.Width;
                data[1] = MatrixFrame.Height;
                return(data);
                //return null;
            }
            try
            {
                data[0] = int.Parse(width);
                data[1] = int.Parse(height);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message + " " + width + " " + height);
                return(null);
            }
            return(data);
        }