Esempio n. 1
0
        private async void BUpdate_Click(object sender, RoutedEventArgs e)
        {
            Controller.GenerateTestData();
            //Snapshot.Current.LastUpdate = DateTimeOffset.Now;
            //Message.Show(Controller.Serialize(), "");
            //Message.Show(JsonConvert.SerializeObject(Platform.Current.Models.First().Objects.First().Properties[3]), "");
            if ((sender as Button) != null)
            {
                var path = new Path();
                path.SetResourceReference(Path.DataProperty, "Loading");
                path.SetResourceReference(Shape.FillProperty, "MainColor");
                var but = new Border {
                    Child = path
                };
                var da = new DoubleAnimation(0, 359, new Duration(TimeSpan.FromMilliseconds(600)));
                var rt = new RotateTransform();
                but.RenderTransform       = rt;
                but.RenderTransformOrigin = new Point(0.5, 0.5);
                da.RepeatBehavior         = RepeatBehavior.Forever;
                ((Button)sender).Content  = but;
                rt.BeginAnimation(RotateTransform.AngleProperty, da);
            }
            await Task.Run(async() =>
            {
                try
                {
                    //Network.GetDataFromServer();
                    await Dispatcher.BeginInvoke(new Action(delegate
                    {
                        DGProp.ItemsSource  = View.ModelToView();
                        Lmodels.ItemsSource = Platform.Current.Models;
                        if (Lobjects.SelectedItem != null)
                        {
                            stackscroll.Content = View.GetDashboard(Lobjects.SelectedItem as Object);
                        }
                    }));
                }
                catch { Message.Show((string)Application.Current.Resources["Dialogid7"], (string)Application.Current.Resources["Dialogid5"]); }
            });

            if ((sender as Button) != null)
            {
                var path = new Path();
                path.SetResourceReference(Path.DataProperty, "Update");
                path.SetResourceReference(Shape.FillProperty, "MainColor");
                var but = new Border {
                    Child = path
                };
                ((Button)sender).Content = but;
            }
        }