Implement Calculator Functionality Using MVVM - .NET MAUI Calculator App 03

Поділитися
Вставка
  • Опубліковано 22 гру 2024

КОМЕНТАРІ • 4

  • @JamesMCrutchley
    @JamesMCrutchley 5 місяців тому

    TY for the video. It's too bad you did not include any code on how to do the calculations. So essentially this is great for UI but will never work without the user spending time creating the methods to do the calculations. If you want to create a demo for UI that is fine. But saying you will show how to create a calculator app and not actually finishing it is kind of pisses off the user. Sure I can figure it out given enough time. But I have other things I need to do. TY for help with UI but most of this is just completely useless if anyone watching wants to actually have a functional calculator app at the end.

    • @dotnetbuilds
      @dotnetbuilds  5 місяців тому +1

      Here's the code for the MainPageViewModel: goonlinetools.com/snapshot/code/#cb0ijs1iiluajnb3zdopan

    • @JamesMCrutchley
      @JamesMCrutchley 5 місяців тому

      @@dotnetbuilds TY that was incredibly fast and also helpful :)

    • @JamesMCrutchley
      @JamesMCrutchley 5 місяців тому

      This fixes a few issues string GenerateExpression()
      {
      var item = CalcDisplay.Replace('×', '*').Replace('÷', '/').Replace(")+", "+").Replace("%", "*0.01").Replace(")*", "*").Replace(")", "*").Replace("*(", "*").Replace('(', '*').Replace("+*", "+");
      item = item.First() == '*' ? item.Remove(0, 1) : item;
      item = item.Last() == '*' ? item.Remove(item.Length - 1, 1) : item;
      item = item.First() == '(' ? item.Remove(0, 1) : item;
      item = item.Last() == ')' ? item.Remove(item.Length - 1, 1) : item;
      return item;
      }