Example #1
0
        private void OptInput_Click(object sender, RoutedEventArgs e)
        {
            var InputItems = new ToggleMenuFlyoutItem[] {
                optInputTeX,
                optInputAM
            };

            foreach (var item in InputItems)
            {
                if (item == sender)
                {
                    item.IsChecked = true;
                    var btnName = item.Name;
                    if (sender == optInputTeX)
                    {
                        CURRENT_MATHINPUT = MATH_INPUT_FORMAT.TeX;
                    }
                    else if (sender == optInputAM)
                    {
                        CURRENT_MATHINPUT = MATH_INPUT_FORMAT.AsciiMath;
                    }
                    LoadMathInputFormat(CURRENT_MATHINPUT);
                    Settings.Set("MathInput", CURRENT_MATHINPUT.ToString());
                }
                else
                {
                    item.IsChecked = false;
                }
            }
        }
Example #2
0
        private void LoadMathInputFormat(MATH_INPUT_FORMAT fmt)
        {
            switch (fmt)
            {
            case MATH_INPUT_FORMAT.TeX:
                MathView.Source       = new Uri("ms-appx-web:///Assets/Statics/html/mathviewer_tex.html");
                optInputTeX.IsChecked = true;
                optInputAM.IsChecked  = false;
                break;

            case MATH_INPUT_FORMAT.AsciiMath:
                MathView.Source       = new Uri("ms-appx-web:///Assets/Statics/html/mathviewer_asciimath.html");
                optInputTeX.IsChecked = false;
                optInputAM.IsChecked  = true;
                break;

            default:
                MathView.Source       = new Uri("ms-appx-web:///Assets/Statics/html/mathviewer_tex.html");
                optInputTeX.IsChecked = true;
                optInputAM.IsChecked  = false;
                break;
            }
        }
Example #3
0
        public LaTeXPage()
        {
            this.InitializeComponent();

            NavigationCacheMode = NavigationCacheMode.Enabled;

            optWrapText.IsChecked = true;

            edSrc.TextWrapping = TextWrapping.Wrap;
            edSrc.IsEnabled    = false;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(@"\begin{equation}");
            sb.AppendLine(@"\frac{\partial\psi}{\partial t} = \kappa\mathrm{\nabla}^2\psi \\");
            sb.AppendLine(@"");
            sb.AppendLine(@"\begin{aligned}");
            sb.AppendLine(@"");
            sb.AppendLine(@"x &= r (cos(t) + t sin(t)) \\");
            sb.AppendLine(@"y &= r (sin(t) - t cos(t)) \\");
            sb.AppendLine(@"");
            sb.AppendLine(@"\end{aligned}");
            sb.AppendLine(@"\end{equation}");
            DEFAULT_FORMULAR = sb.ToString();
            CURRENT_FORMULAR = DEFAULT_FORMULAR;

            try
            {
                CURRENT_SCALE = Settings.Get("MathScale", CURRENT_SCALE);
            }
            catch (Exception) { }
            var ScaleItems = new ToggleMenuFlyoutItem[] {
                optScale100,
                optScale125, optScale133, optScale150,
                optScale200, optScale250,
                optScale300,
                optScale400
            };

            foreach (var item in ScaleItems)
            {
                var scaleName = item.Name.Substring("optScale".Length);
                if (int.Parse(scaleName) == CURRENT_SCALE)
                {
                    item.IsChecked = true;
                }
                else
                {
                    item.IsChecked = false;
                }
            }

            try
            {
                CURRENT_MATHINPUT = (MATH_INPUT_FORMAT)Enum.Parse(typeof(MATH_INPUT_FORMAT), (string)Settings.Get("MathInput", CURRENT_MATHINPUT.ToString()));
            }
            catch (Exception)
            {
            }

            MathView.DefaultBackgroundColor = CURRENT_BGCOLOR;
            MathView.CanDrag = false;
            //MathView.CompositeMode = ElementCompositeMode.SourceOver;
            LoadMathInputFormat(CURRENT_MATHINPUT);
        }