Esempio n. 1
0
        public MappedItem FindOrCreateMappedItem(string parentId, string name, Rect bounds, string type, string text)
        {
            MappedItem parentMappedItem = GetMappedItem(parentId);

            MappedItem mappedItem = parentMappedItem.Children
                .FirstOrDefault(m => m.Name == name
                                && m.Bounds.X == bounds.X
                                && m.Bounds.Y == bounds.Y
                                && m.Bounds.Width == bounds.Width
                                && m.Bounds.Height == bounds.Height
                                && m.Type == type);

            if (mappedItem != null)
                return mappedItem;

            mappedItem = new AppControl();
            mappedItem.ParentId = parentId;
            mappedItem.Bounds = bounds;
            mappedItem.Name = name;

            if (mappedItem.Name.IsNullOrEmpty())
            {
                mappedItem.FriendlyName = text + " " + type;
            }

            mappedItem.Type = type;
            mappedItem.Text = text;

            parentMappedItem.Children.Add(mappedItem);

            cachedMappedItemDict[mappedItem.Id] = mappedItem;

            return mappedItem;
        }
Esempio n. 2
0
        /// <summary>
        /// Phasefield instantiation, constructor
        /// </summary>
        public Phasefield(PhasefieldControl _Control, LevelSet _LevSet, SinglePhaseField _DGLevSet, LevelSetTracker _LsTrk, VectorField <SinglePhaseField> _Velocity, IGridData _GridData, AppControl _control, AggregationGridData[] _mgSeq)
        {
            if (_Control != null)
            {
                this.Init(_Control);
            }
            else
            {
                this.Init(new PhasefieldControl());
            }

            LevSet = _LevSet;
            //LsTrk = _LsTrk;
            DGLevSet      = _DGLevSet;
            Velocity      = _Velocity;
            GridData      = _GridData;
            ParentControl = _control;
            mgSeq         = _mgSeq;
        }
Esempio n. 3
0
 internal ResultEventArgs(ContentCategory category, AppControl result, AppControlReplyResult resultCode)
 {
     _category   = category;
     _result     = result;
     _resultCode = resultCode;
 }
Esempio n. 4
0
 /// <summary>
 /// Overrides this method if want to handle behavior when the component receives the start command message.
 /// </summary>
 /// <param name="appControl">appcontrol object</param>
 /// <param name="restarted">True if it was restarted</param>
 /// <since_tizen> 6 </since_tizen>
 public virtual void OnStartCommand(AppControl appControl, bool restarted)
 {
 }
Esempio n. 5
0
 public void BindControl(AppControl control)
 {
     throw new NotImplementedException();
 }
Esempio n. 6
0
 private void OnLaunchResult(AppControl launchRequest, AppControl replyRequest, AppControlReplyResult result)
 {
     Tizen.Log.Info(Tag, $"Result of the request: {result}");
 }
 /// <summary>
 /// A range of control objects over which the condition number scaling is performed.
 /// </summary>
 /// <param name="BaseControl">
 /// basic settings
 /// </param>
 /// <param name="GridFuncs">
 /// a sequence of grid-generating functions, (<see cref="AppControl.GridFunc"/>),
 /// which defines the grid for each run
 /// </param>
 public void SetControls(AppControl BaseControl, IEnumerable <Func <IGrid> > GridFuncs)
 {
     Controls = new MyEnu(BaseControl, GridFuncs.ToArray());
 }
Esempio n. 8
0
 internal void SendLaunchRequest(AppControl appControl)
 {
     this.frameBroker.SendLaunchRequest(appControl, true);
 }
Esempio n. 9
0
        static void Main()
        {
            AppControl controller = new AppControl();

            controller.FirstMessage();
        }
Esempio n. 10
0
        static async Task <Contact> PlatformPickContactAsync()
        {
            Permissions.EnsureDeclared <Permissions.ContactsRead>();
            await Permissions.EnsureGrantedAsync <Permissions.ContactsRead>();

            var tcs = new TaskCompletionSource <Contact>();

            var appControl = new AppControl();

            appControl.Operation = AppControlOperations.Pick;
            appControl.ExtraData.Add(AppControlData.SectionMode, "single");
            appControl.LaunchMode = AppControlLaunchMode.Single;
            appControl.Mime       = "application/vnd.tizen.contact";

            AppControl.SendLaunchRequest(appControl, (request, reply, result) =>
            {
                Contact contact = null;

                if (result == AppControlReplyResult.Succeeded)
                {
                    var contactId = reply.ExtraData.Get <IEnumerable <string> >(AppControlData.Selected)?.FirstOrDefault();

                    if (int.TryParse(contactId, out var contactInt))
                    {
                        var mgr = new ContactsManager();

                        var record = mgr.Database.Get(TizenContact.Uri, contactInt);

                        if (record != null)
                        {
                            string name = null;
                            var emails  = new List <ContactEmail>();
                            var phones  = new List <ContactPhone>();

                            var recordName = record.GetChildRecord(TizenContact.Name, 0);
                            if (recordName != null)
                            {
                                var first = recordName.Get <string>(TizenName.First) ?? string.Empty;
                                var last  = recordName.Get <string>(TizenName.Last) ?? string.Empty;

                                name = $"{first} {last}".Trim();
                            }

                            var emailCount = record.GetChildRecordCount(TizenContact.Email);
                            for (var i = 0; i < emailCount; i++)
                            {
                                var item = record.GetChildRecord(TizenContact.Email, i);
                                var addr = item.Get <string>(TizenEmail.Address);
                                var type = (TizenEmail.Types)item.Get <int>(TizenEmail.Type);

                                emails.Add(new ContactEmail(addr, GetContactType(type)));
                            }

                            var phoneCount = record.GetChildRecordCount(TizenContact.Number);
                            for (var i = 0; i < phoneCount; i++)
                            {
                                var item   = record.GetChildRecord(TizenContact.Number, i);
                                var number = item.Get <string>(TizenNumber.NumberData);
                                var type   = (TizenNumber.Types)item.Get <int>(TizenNumber.Type);

                                phones.Add(new ContactPhone(number, GetContactType(type)));
                            }

                            contact = new Contact(name, phones, emails, ContactType.Unknown);
                        }
                    }
                }

                tcs.TrySetResult(contact);
            });

            return(await tcs.Task);
        }
Esempio n. 11
0
        /// <summary>
        /// Runs the solver described by the control object <paramref name="ctrl"/> on a batch system from the currently defined queues (<see cref="InteractiveShell.ExecutionQueues"/>).
        /// The method returns immediately.
        /// </summary>
        /// <param name="ctrl"></param>
        /// <param name="queueIdx">
        /// Index int <see cref="InteractiveShell.ExecutionQueues"/>
        /// </param>
        public static Job RunBatch(this AppControl ctrl, int queueIdx = 0)
        {
            var b = InteractiveShell.ExecutionQueues[queueIdx];

            return(RunBatch(ctrl, InteractiveShell.ExecutionQueues[queueIdx]));
        }
Esempio n. 12
0
        public override void Validate(AppControl control)
        {
            AppForm form = control.Control as AppForm;

            if (form == null)
            {
                return;                //不是grid
            }
            List <string> fields = GetFields(control.DataSource.Sql);

            foreach (AppFormTab tab in form.Tabs)
            {
                foreach (AppFormSection section in tab.Sections)
                {
                    foreach (AppFormItem item in section.Items)
                    {
                        string field = string.IsNullOrEmpty(item.Name) ? item.Field : item.Name;

                        if (string.IsNullOrEmpty(field))
                        {
                            //AddResult(string.Format("{0}未设置item控件名,请设置field或name的值,否则控件将自动命名为Unnamed+数字", item.Title), Level.Warn);
                            field = string.Format("tab:{0}, section: {1},", tab.Title, section.Title);
                        }

                        ValidateReq(item.Req, field);
                        ValidateCreateapi(item.Createapi, field);
                        ValidateUpdateapi(item.Updateapi, field);

                        if (item.Type.EqualIgnoreCase(AppFormItemType.Datetime.ToString()))
                        {
                            ValidateTime(item.Time, field);
                        }

                        if (item.Type.EqualIgnoreCase(AppFormItemType.Select.ToString()))
                        {
                            if (!string.IsNullOrEmpty(item.Sql))
                            {
                                string error = "";
                                if (ValidateSql(item.Sql, out error) == false)
                                {
                                    AddResult(field, "sql", "正确执行", error, Level.Error);
                                }
                            }
                        }

                        if (control.State.IsSqlPassed)
                        {
                            if (!string.IsNullOrEmpty(item.Field) && !fields.Contains(item.Field.ToLower()))
                            {
                                Results.Add(new Result("字段配置错误", "SQL中未包含列" + item.Field, Level.Error,
                                                       typeof(AppFormValidation)));
                            }
                        }

                        ValidateAttribute(item.OtherAttributes, item.Title);

                        ValidateValue(item.Type, item.DefaultValue, item.Title);
                    }
                }
            }
        }
Esempio n. 13
0
        public override void Validate(AppControl control)
        {
            AppGrid grid = control.Control as AppGrid;

            if (grid == null)
            {
                return;  //不是grid
            }

            var ds = control.DataSource;

            if (ds == null)
            {
                Results.Add(new Result("AppGridE", "未配置数据源", Level.Warn, typeof(AppGridEValidation)));
                return;
            }

            if (grid.Row != null && grid.Row.AppGridCells.Count > 0)
            {
                //List<bool> _sumtype = new List<bool>();
                string _strSumTemp = "";

                if (grid.Summary != null && grid.Summary.AppGridCells.Count > 0)
                {
                    for (int i = 0; i < grid.Summary.AppGridCells.Count; i++)
                    {
                        var scell = grid.Summary.AppGridCells[i];
                        if (scell.SumTotalField.IsNotNullOrEmpty())
                        {
                            _strSumTemp += "," + scell.SumTotalField + " AS _s" + i;
                        }
                    }
                }

                //appGridE, appGrid
                foreach (var cell in grid.Row.AppGridCells)
                {
                    string strSql1 = "", strSql2 = "", _strSQL = "";
                    string error = string.Empty;

                    //替换关键字
                    string strSQL = CommonValidation.GetFilter(ds.Sql);

                    if (ds.PageMode.EqualIgnoreCase("2"))
                    {
                        string[] arrSql = SplitSql(strSQL);

                        if (arrSql != null)
                        {
                            strSql1 = arrSql[0];                                // 外层不带“SELECT”关键字的部分 SQL 语句
                            strSQL  = arrSql[1];                                // 内层从“SELECT”关键字开始的 SQL 语句
                            strSql2 = GetSortedSql(arrSql[2], cell, ds);        // 外层 SQL
                        }
                    }

                    strSQL = GetSortedSql(strSQL, cell, ds);

                    //是否分页allowpaging, pageSize == 0
                    //allowpaing
                    if (ds.KeyName.IsNotNullOrEmpty())
                    {
                        //取记录数 if showPageCount
                        string strSQLTemp = Regex.Replace(strSQL, @"SELECT\s+([\w|\W]+)\s+FROM", "SELECT COUNT(*)" + _strSumTemp + " FROM");
                        strSQLTemp = Regex.Replace(strSQLTemp, @"\s+ORDER BY([\w|\W]+)", "");
                        if (!ValidateSql(strSQLTemp, out error))
                        {
                            Results.Add(new Result(string.Format("检查数据列{0}", cell.Field),
                                                   string.Format("{0}字段当showPageCount == true时会出错:{1}", cell.OrderBy, error), Level.Warn,
                                                   GetType()));
                            return;
                        }

                        if (ds.PageMode.EqualIgnoreCase("2"))
                        {
                            _strSQL = GetPageSql(strSQL, ds.Entity, ds.KeyName, ds.PageMode);
                            _strSQL = strSql1 + _strSQL + strSql2;
                        }
                        else
                        {
                            _strSQL = GetPageSql(strSQL, ds.Entity, ds.KeyName, ds.PageMode);
                        }
                    }
                    else
                    {
                        //不指定主键的分页查询
                    }

                    if (strSQL.IsNotNullOrEmpty() && !ValidateSql(_strSQL, out error))
                    {
                        Results.Add(new Result(string.Format("检查数据列{0}", cell.Field),
                                               string.Format("排序字段配置错误{0}:{1}", cell.OrderBy, error), Level.Error,
                                               GetType()));
                    }

                    if (cell.Attribute != null)
                    {
                        foreach (var attr in cell.Attribute.Attributes)
                        {
                            if (attr.Name.EqualIgnoreCase("sql"))
                            {
                                if (CommonValidation.IsIncorrectSql(attr.Value))
                                {
                                    Results.Add(new Result("AppGridE",
                                                           string.Format("[{0}]单元格的SQL有误:{1}", cell.Title,
                                                                         attr.Value), Level.Error,
                                                           typeof(AppGridEValidation)));
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        public DetailPage(int id)
        {
            InitializeComponent();

            WaitingView.Opacity = 1.0;

            Task.Run(async() =>
            {
                var client      = new TMDbClient(TMDbAPIKey.Key);
                var taskMovie   = client.GetMovieAsync(id);
                var taskSimilar = client.GetMovieSimilarAsync(id);
                var taskCredit  = client.GetMovieCreditsAsync(id);
                var taskVideo   = client.GetMovieVideosAsync(id);
                var movie       = await taskMovie;

                Device.BeginInvokeOnMainThread(async() =>
                {
                    WaitingView.Opacity = 0.0;
                    _movie         = movie;
                    BindingContext = movie;

                    var credit = await taskCredit;
                    var cast   = new CastListModel
                    {
                        Items = credit.Cast
                    };
                    CastList.BindingContext = cast;

                    var similars = await taskSimilar;
                    _similars    = new MovieListModel
                    {
                        Title = "Similar Movies",
                        Items = similars.Results,
                    };
                    SimilarList.BindingContext = _similars;

                    var videos = await taskVideo;
                    int i      = 0;
                    foreach (var video in videos.Results)
                    {
                        if (video.Site == "YouTube")
                        {
                            i++;
                            var button = new Button
                            {
                                Text = $"Watch trailer #{i}",
                                HorizontalOptions = LayoutOptions.Center,
                                VerticalOptions   = LayoutOptions.CenterAndExpand
                            };
                            button.Clicked += (s, e) =>
                            {
#if USE_VIDEOPAGE
                                Navigation.PushAsync(new VideoPage(video.Key));
#else
                                AppControl appControl    = new AppControl();
                                appControl.ApplicationId = "com.samsung.tv.cobalt-yt";
                                appControl.Operation     = AppControlOperations.Default;
                                appControl.ExtraData.Add("PAYLOAD", $"#play?v={video.Key}");
                                AppControl.SendLaunchRequest(appControl);
#endif
                                Console.WriteLine($"ID : {video.Key}");
                            };
                            Console.WriteLine($"Video : {video.Key} {video.Name} {video.Site}");
                            ButtonArea.Children.Add(button);

                            InputEvents.GetEventHandlers(button).Add(
                                new RemoteKeyHandler((arg) => {
                                if (arg.KeyName == RemoteControlKeyNames.Up)
                                {
                                    ScrollView.ScrollToAsync(0, 0, true);
                                    arg.Handled = true;
                                }
                            }, RemoteControlKeyTypes.KeyDown
                                                     ));
                        }
                        if (i > 2)
                        {
                            break;
                        }
                    }
                });
            });
        }
        private List <Result> ValidateSql(AppControl control)
        {
            DataSource    ds   = control.DataSource;
            List <Result> list = new List <Result>();

            if (ds.Sql.IndexOf("SELECT ") < 0)
            {
                Results.Add(new Result("SQL检测", "未检测到SELECT关键字,检查是否大写或者是否少空格", Level.Error, GetType()));
                control.State.IsCeased = true;
                return(list);
            }

            if (!Regex.IsMatch(ds.Sql, "(select|from|where)", RegexOptions.IgnoreCase) && !(ds.Type.EqualIgnoreCase("sp") || ds.Type.EqualIgnoreCase("StoredProcedure")))
            {
                list.Add(new Result("DataSource的Type配置错误", "ERP3.0后SQL若配置为存储过程,则type必须为SP或StoredProcedure", Level.Error, base.GetType()));
            }

            int pagemode = Convert.ToInt32(ds.PageMode);

            if (pagemode > 2 || pagemode < 0)
            {
                list.Add(new Result("DataSource的pagemode属性值错误", "仅支持0,1,2", Level.Error, base.GetType()));
                return(list);
            }

            string err;

            if (!CommonValidation.CheckCase(ds.Sql, pagemode, out err))
            {
                list.Add(new Result("SQL关键字大小写检查", string.Format("{0}\n{1}", err, ds.Sql), Level.Warn, base.GetType()));
            }

            try
            {
                string sql = Regex.Replace(ds.Sql, @"([=|in|<>]+\s*)\[[^a-z]*\]", "$1(null)", RegexOptions.IgnoreCase);

                if (CommonValidation.HasSqlKeywords(sql))
                {
                    list.Add(new Result("SQL中特定关键字检查", string.Format("存在特定关键字option|COMPUTE\n{0}", ds.Sql), Level.Error, base.GetType()));
                }

                //标识SQL语法是否验证通过,分页的SQL可能就是错的,就不执行语法检测了
                if (pagemode != 2)
                {
                    if (NoAliasSqlCustom(sql))
                    {
                        list.Add(new Result("SQL中的Select字段检查", "无别名", Level.Error, base.GetType()));
                    }

                    control.State.IsSqlPassed = !CommonValidation.IsIncorrectSql(ds.Sql);
                }
            }
            catch (SqlException sqlException)
            {
                list.Add(new Result("执行错误", "SQL语法检查" + sqlException.Message, Level.Error, base.GetType()));
            }
            catch (Exception e)
            {
                list.Add(new Result("执行错误", "SQL语法检查" + e.StackTrace, Level.Warn, base.GetType()));
            }
            return(list);
        }
Esempio n. 16
0
 protected override void SetBoundaryValues(AppControl R)
 {
     R.AddBoundaryValue(BoundaryType.Dirichlet.ToString(), "T",
                        X => Math.Pow(X[0], 2) + Math.Pow(X[1], 2));
 }
 public XDGCompressibleBoundaryCondMap(IGridData gridData, AppControl control, Material material, string[] speciesNames) : base(gridData, control, material)
 {
     this.speciesNames = speciesNames;
     InitXDGConditionMap();
 }
        /// <summary>
        /// Share a message with compatible services
        /// </summary>
        /// <param name="message">Message to share</param>
        /// <param name="options">Platform specific options</param>
        /// <returns>True if the operation was successful, false otherwise</returns>
        public Task <bool> Share(ShareMessage message, ShareOptions options = null)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            try
            {
                string     sharedResourcePath = Application.Current.ApplicationInfo.SharedResourcePath.ToString();
                AppControl appControl         = new AppControl();

                if (options != null)
                {
                    switch (options.ExcludedAppControlTypes)
                    {
                    case ShareAppControlType.FileInEmail:
                        appControl.Operation = AppControlOperations.Share;
                        appControl.Uri       = "mailto:";
                        if (message.Url == null)
                        {
                            throw new ArgumentNullException(nameof(message.Url));
                        }
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/path", sharedResourcePath + "/" + message.Url);
                        break;

                    case ShareAppControlType.FileInMessage:
                        appControl.Operation = AppControlOperations.Share;
                        appControl.Uri       = "mmsto:";
                        if (message.Url == null)
                        {
                            throw new ArgumentNullException(nameof(message.Url));
                        }
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/path", sharedResourcePath + "/" + message.Url);
                        break;

                    case ShareAppControlType.TextInEmail:
                        appControl.Operation = AppControlOperations.ShareText;
                        appControl.Uri       = "mailto:";
                        if (message.Text == null)
                        {
                            throw new ArgumentNullException(nameof(message.Text));
                        }
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", message.Title);
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Text);
                        //appControl.ExtraData.Add("http://tizen.org/appcontrol/data/url", message.Url);
                        break;

                    case ShareAppControlType.TextInSMS:
                        appControl.Operation = AppControlOperations.ShareText;
                        appControl.Uri       = "sms:";
                        if (message.Text == null)
                        {
                            throw new ArgumentNullException(nameof(message.Text));
                        }
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", message.Title);
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Text);
                        //appControl.ExtraData.Add("http://tizen.org/appcontrol/data/url", message.Url);
                        break;

                    case ShareAppControlType.TextInMMS:
                        appControl.Operation = AppControlOperations.ShareText;
                        appControl.Uri       = "mmsto:";
                        if (message.Text == null)
                        {
                            throw new ArgumentNullException(nameof(message.Text));
                        }
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", message.Title);
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Text);
                        //appControl.ExtraData.Add("http://tizen.org/appcontrol/data/url", message.Url);
                        break;

                    case ShareAppControlType.Link:
                        appControl.Operation = AppControlOperations.ShareText;
                        if (message.Url == null)
                        {
                            throw new ArgumentNullException(nameof(message.Url));
                        }
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", message.Title);
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/url", message.Text);
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Url);
                        break;

                    default:
                        appControl.Operation = AppControlOperations.ShareText;
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", message.Title);
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Text);
                        appControl.ExtraData.Add("http://tizen.org/appcontrol/data/url", message.Url);
                        break;
                    }
                }
                else
                {
                    appControl.Operation = AppControlOperations.ShareText;
                    appControl.ExtraData.Add("http://tizen.org/appcontrol/data/subject", message.Title);
                    appControl.ExtraData.Add("http://tizen.org/appcontrol/data/text", message.Text);
                    appControl.ExtraData.Add("http://tizen.org/appcontrol/data/url", message.Url);
                }

                AppControl.SendLaunchRequest(appControl);

                return(Task.FromResult(true));
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Unable to share: " + ex.Message);
                return(Task.FromResult(false));
            }
        }
Esempio n. 19
0
 public abstract void Validate(AppControl control);
Esempio n. 20
0
        //MovieListModel _similars;

        public DetailPage(int id)
        {
            InitializeComponent();

            WaitingView.Opacity = 1.0;

            Task.Run(async() =>
            {
                AppInfo movie = await AppService.GetAppInfoAsync(id);

                Device.BeginInvokeOnMainThread(async() =>
                {
                    WaitingView.Opacity = 0.0;
                    _movie         = movie;
                    BindingContext = movie;

                    var button = new Button
                    {
                        Text = "Show Demo",
                        HorizontalOptions = LayoutOptions.Center,
                        VerticalOptions   = LayoutOptions.CenterAndExpand
                    };
                    button.Clicked += async(s, e) =>
                    {
                        if ((movie.Id / 10 == 5))
                        {
                            try
                            {
                                AppControl appControl    = new AppControl();
                                appControl.ApplicationId = movie.AppId;
                                appControl.Operation     = AppControlOperations.Default;
                                appControl.ExtraData.Add("key", "value");
                                AppControl.SendLaunchRequest(appControl);
                            }
                            catch (Exception ee)
                            {
                                Log.Error("Demo", "Launch App " + ee + " " + ee.Message);
                            }
                            Log.Error("Demo", "Launch App " + movie.AppId);
                        }
                        else
                        {
                            var StartClassType = GetType().GetTypeInfo();
                            Assembly asm       = StartClassType.Assembly;

                            IEnumerable <Type> _tcs = from tc in asm.DefinedTypes
                                                      where tc.Name == movie.Title
                                                      select tc.AsType();

                            foreach (Type type in _tcs)
                            {
                                Page page  = (Page)Activator.CreateInstance(type);
                                page.Title = movie.OriginalTitle;
                                Log.Error("Demo", "Push page ");
                                await Navigation.PushAsync(page);
                            }
                        }
                    };
                    ButtonArea.Children.Add(button);

                    InputEvents.GetEventHandlers(button).Add(
                        new RemoteKeyHandler((arg) =>
                    {
                        if (arg.KeyName == RemoteControlKeyNames.Up)
                        {
                            ScrollView.ScrollToAsync(0, 0, true);
                            arg.Handled = true;
                        }
                    }, RemoteControlKeyTypes.KeyDown
                                             ));
                });
            });
        }
Esempio n. 21
0
 public virtual IEnumerable ValidateControl(AppControl control)
 {
     Validate(control);
     return(Results);
 }
Esempio n. 22
0
 public void SendLaunchRequest(AppControl appControl)
 {
     TransitionOptions?.SendLaunchRequest(appControl);
 }
Esempio n. 23
0
 /// <summary>
 /// Constructs a new map by searching through all the edge tags
 /// (<see cref="GridData.EdgeData.EdgeTags"/> and instantiating sub classes
 /// of <see cref="CompressibleBoundaryCondMap"/> specific for the compressible
 /// Navier-Stokes solver depending on their edge tag names.
 /// </summary>
 /// <param name="gridData">The omnipresent grid data</param>
 /// <param name="control">Configuration options</param>
 public CompressibleBoundaryCondMap(IGridData gridData, AppControl control, MaterialProperty.Material __material) : base(gridData, control.BoundaryValues, bndFuncNames)
 {
     this.gridData = gridData;
     this.Material = __material;
     InitConditionMap();
 }
Esempio n. 24
0
 public override void OnStart(AppControl appControl, bool restarted)
 {
     base.OnStart(appControl, restarted);
 }
Esempio n. 25
0
        /// <summary>
        /// Verifies a control object, especially if it is suitable for serialization.
        /// </summary>
        /// <param name="ctrl"></param>
        public static void VerifyEx(this AppControl ctrl)
        {
            // call basic verification
            ctrl.Verify();

            // see is legacy-features are used, which don't support serialization.
            if (ctrl.GridFunc != null)
            {
                throw new ArgumentException("'GridFunc' is not supported - cannot be serialized.");
            }
            if (ctrl.DynamicLoadBalancing_CellCostEstimatorFactories.Count != 0)
            {
                throw new ArgumentException("'DynamicLoadBalancing_CellCostEstimatorFactories' is not supported - cannot be serialized.");
            }

            // try serialization/deserialization
            AppControl ctrlBack;

            if (ctrl.GeneratedFromCode)
            {
                string code = ctrl.ControlFileText;

                AppControl.FromCode(code, ctrl.GetType(), out AppControl c, out AppControl[] cS);
                if (cS != null)
                {
                    ctrlBack = cS[ctrl.ControlFileText_Index];
                }
                else
                {
                    ctrlBack = c;
                }
            }
            else
            {
                string JSON = ctrl.Serialize();
                ctrlBack = AppControl.Deserialize(JSON);//, ctrl.GetType());
            }
            ctrlBack.Verify();

            // compare original and de-serialized object
            if (!ctrl.Tags.SetEquals(ctrlBack.Tags))
            {
                throw new ArgumentException("Unable to serialize/deserialize tags correctly.");
            }

            if (!ctrl.InitialValues.Keys.SetEquals(ctrlBack.InitialValues.Keys))
            {
                throw new ArgumentException("Unable to serialize/deserialize initial values correctly.");
            }

            foreach (var ivk in ctrl.InitialValues.Keys)
            {
                var f1 = ctrl.InitialValues[ivk];
                var f2 = ctrlBack.InitialValues[ivk];

                if (!f1.Equals(f2))
                {
                    throw new ArgumentException("Unable to serialize/deserialize initial values correctly.");
                }
            }

            if (!ctrl.FieldOptions.Keys.SetEquals(ctrlBack.FieldOptions.Keys))
            {
                throw new ArgumentException("Unable to serialize/deserialize field options correctly.");
            }
            foreach (var fok in ctrl.FieldOptions.Keys)
            {
                var o1 = ctrl.FieldOptions[fok];
                var o2 = ctrlBack.FieldOptions[fok];

                if (!o1.Equals(o2))
                {
                    throw new ArgumentException("Unable to serialize/deserialize field options correctly.");
                }
            }

            if (!ctrl.InitialValues_Evaluators.Keys.SetEquals(ctrlBack.InitialValues_Evaluators.Keys))
            {
                throw new ArgumentException("Unable to serialize/deserialize initial values correctly.");
            }

            if (!ctrl.BoundaryValues.Keys.SetEquals(ctrlBack.BoundaryValues.Keys))
            {
                throw new ArgumentException("Unable to serialize/deserialize boundary values correctly.");
            }

            foreach (var bvk in ctrl.BoundaryValues.Keys)
            {
                var bvc = ctrl.BoundaryValues[bvk];
                var bvd = ctrlBack.BoundaryValues[bvk];

                if (!bvc.Evaluators.Keys.SetEquals(bvd.Evaluators.Keys))
                {
                    throw new ArgumentException("Unable to serialize/deserialize boundary values correctly.");
                }

                if (!bvc.Values.Keys.SetEquals(bvd.Values.Keys))
                {
                    throw new ArgumentException("Unable to serialize/deserialize boundary values correctly.");
                }

                foreach (string s in bvc.Values.Keys)
                {
                    var f1 = bvc.Values[s];
                    var f2 = bvd.Values[s];

                    if (!f1.Equals(f2))
                    {
                        throw new ArgumentException("Unable to serialize/deserialize boundary values correctly.");
                    }
                }
            }

            // reflection comparison
            var D1 = new Dictionary <string, object>();
            var D2 = new Dictionary <string, object>();

            BoSSS.Solution.Application.FindKeys(D1, ctrl);
            BoSSS.Solution.Application.FindKeys(D2, ctrlBack);
            foreach (var kv1 in D1)
            {
                string name = kv1.Key;
                var    o1   = kv1.Value;

                if ((!D2.ContainsKey(name)) || (!o1.Equals(D2[name])))
                {
                    throw new ArgumentException("Unable to serialize/deserialize '" + name + "' correctly. (Missing a DataMemberAtribute in control class?)");
                }
            }
        }
Esempio n. 26
0
 public override void OnStart(AppControl appControl, bool restarted)
 {
     Tizen.Log.Error("MYLOG", "MyFrameComponent OnStart");
 }
Esempio n. 27
0
 public void SetGridAndBoundaries(AppControl R)
 {
     R.GridFunc = GridFunc;
     SetBoundaryValues(R);
 }
Esempio n. 28
0
 public override void Init(AppControl control)
 {
     control.GridPartType = BoSSS.Foundation.Grid.GridPartType.none;
     base.Init(control);
 }
Esempio n. 29
0
 protected abstract void SetBoundaryValues(AppControl R);
Esempio n. 30
0
        /// <summary>
        /// Updating Phasefield after changes in Grid and/or Basis
        /// </summary>
        public void UpdateFields(LevelSet _LevSet, SinglePhaseField _DGLevSet, LevelSetTracker _LsTrk, VectorField <SinglePhaseField> _Velocity, IGridData _GridData, AppControl _control, AggregationGridData[] _mgSeq)
        {
            // check if signature of external and local Grid changed
            if (this.GridData != _GridData)
            {
                Console.WriteLine("Grid changed, adapting Phasefield");
                LevSet = _LevSet;
                //LsTrk = _LsTrk;
                DGLevSet      = _DGLevSet;
                Velocity      = _Velocity;
                GridData      = _GridData;
                ParentControl = _control;
                mgSeq         = _mgSeq;

                double Cahn_Old = this.Control.cahn;

                CreateFields();

                if (Math.Abs(Cahn_Old - this.Control.cahn) > 1e-3 * Cahn_Old)
                {
                    //RelaxationStep();
                    ReInit(Cahn_Old, this.Control.cahn);
                }

                m_SOperator = GetOperatorInstance(GridData.SpatialDimension);
                CreateEquationsAndSolvers(null);

                // remember last cahn number for potential reinit
                Cahn_Reinit = this.Control.cahn;
            }
        }
 public void OnAppIconClicked(object sender, ApplicationIconClickedEventArgs args)
 {
     AppLauncher.ApplicationId = args.AppId;
     AppLauncher.Operation     = AppControlOperations.Default;
     AppControl.SendLaunchRequest(AppLauncher);
 }