Exemple #1
0
        /// <summary>
        /// To update application layout
        /// </summary>
        /// <returns>A Task to update application layout asynchrously</returns>
        Task UpdateContentLayout()
        {
            return(Task.Run(() =>
            {
                var selected = ((MainViewModel)BindingContext).SelectedAppControlType;
                var apps = ApplicationControlHelper.GetApplicationIdsForSpecificAppControlType(selected);
                foreach (var app in apps)
                {
                    var iconPath = ApplicationControlHelper.GetApplicationIconPath(app);
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        /// Add an item to the list
                        ((MainViewModel)BindingContext)
                        .Applications.Add(new ApplicationListItem
                        {
                            Id = app,
                            IconPath = iconPath,
                            BlendColor = Color.Gray,
                        });
                    });
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    /// Add an extra empty item.
                    ((MainViewModel)BindingContext)
                    .Applications.Add(new ApplicationListItem
                    {
                        Id = null,
                        IconPath = null,
                        BlendColor = Color.Gray,
                    });
                });
            }));
        }
Exemple #2
0
        /// <summary>
        /// To kill the selected application
        /// </summary>
        public void KillSelectedApplication()
        {
            if (SelectedItem == null || SelectedItem?.Id == null)
            {
                return;
            }

            ApplicationControlHelper.KillApplication(SelectedItem.Id);
        }
Exemple #3
0
        /// <summary>
        /// To execute the selected application
        /// </summary>
        public void ExecuteSelectedApplication()
        {
            if (SelectedItem.Id == null || SelectedAppControlType == AppControlType.Unknown)
            {
                return;
            }

            ApplicationControlHelper.ExecuteApplication(SelectedAppControlType, SelectedItem.Id);
        }
Exemple #4
0
        /// <summary>
        /// To execute the selected application
        /// </summary>
        public void ExecuteSelectedApplication()
        {
            if (SelectedItem == null || SelectedItem?.Id == null || SelectedAppControlType == AppControlType.Unknown)
            {
                return;
            }

            Console.WriteLine($"Execute id:{SelectedItem.Id}, type:{SelectedAppControlType}");
            ApplicationControlHelper.ExecuteApplication(SelectedAppControlType, SelectedItem.Id);
        }
Exemple #5
0
        /// <summary>
        /// To update application layout
        /// </summary>
        /// <returns>A Task to update application layout asynchrously</returns>
        Task UpdateContentLayout()
        {
            return(Task.Run(() =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    _applications.Children.Clear();
                });

                var selected = ((MainViewModel)BindingContext).SelectedAppControlType;
                var apps = ApplicationControlHelper.GetApplicationIdsForSpecificAppControlType(selected);
                foreach (var app in apps)
                {
                    var iconPath = ApplicationControlHelper.GetApplicationIconPath(app);
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        /// Add an item to the list
                        var item = new ApplicationListItem
                        {
                            Id = app,
                            IconPath = iconPath,
                            BlendColor = Color.Gray,
                        };
                        ((MainViewModel)BindingContext).Applications.Add(item);

                        _applications.AddItem(item).Selected += OnItemSelected;
                    });
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    /// Add an empty item to the list
                    var item = new ApplicationListItem
                    {
                        Id = null,
                        IconPath = null,
                        BlendColor = Color.Gray,
                    };
                    ((MainViewModel)BindingContext).Applications.Add(item);

                    _applications.AddItem(item);
                });

                /// For application list
                Children.Add(
                    _applications,
                    Constraint.RelativeToParent((parent) =>
                {
                    return 0;
                }),
                    Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * 0.2411;
                }),
                    Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                    Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * 0.5265;
                }));
            }));
        }
Exemple #6
0
 /// <summary>
 /// To send a message
 /// </summary>
 public void SendMessage()
 {
     ApplicationControlHelper.ExecuteApplication(AppControlType.Send, null, Message);
 }