Exemplo n.º 1
0
        private async void PopulateBtn_Click(object sender, RoutedEventArgs e)
        {
            // Acquire CRUD API
            var crud = UnicontaManager.GetInstance().CrudAPI;

            // Initialize Item
            var myItem = new InvItemClient
            {
                Item        = "109",
                Name        = "Toothbrush",
                CostPrice   = 29.95,
                SalesPrice1 = 100.00,
            };

            // Insert Item
            var result = await crud.Insert(myItem);

            if (result != ErrorCodes.Succes)
            {
                MessageBox.Show("Unable to insert item. Error: " + result.ToString(), "Error");
                return;
            }

            MessageBox.Show("Succesfully inserted item: " + myItem.Item + ", name: " + myItem.Name + "into Uniconta", "Succes");
        }
Exemplo n.º 2
0
 public static UnicontaManager GetInstance()
 {
     if (_instance == null)
     {
         _instance = new UnicontaManager();
     }
     return(_instance);
 }
Exemplo n.º 3
0
        private async void LoginBtn_Click(object sender, RoutedEventArgs e)
        {
            var username = UsernameTextbox.Text;
            var password = PasswordTextbox.Password;

            var loggedIn = await UnicontaManager.GetInstance().Login(username, password);

            if (!loggedIn)
            {
                MessageBox.Show("Failed to log in.", "Error");
                return;
            }

            new LoggedInWindow().Show();
            this.Close();
        }
Exemplo n.º 4
0
 public MainWindow()
 {
     InitializeComponent();
     UnicontaManager.GetInstance().Initialize();
 }
Exemplo n.º 5
0
        protected override async void OnClosed(EventArgs e)
        {
            await UnicontaManager.GetInstance().Logout();

            base.OnClosed(e);
        }