示例#1
0
        private async void UserControl_AfterActionEventHandler(ICore sender, AtomusPageEventArgs e)
        {
            object[] objects;

            try
            {
                switch (e.Action)
                {
                case "UserControl.OpenControl":
                    objects = (object[])e.Value;    //_MENU_ID, _ASSEMBLY_ID, sender, AtomusControlArgs

                    e.Value = this.OpenControl((decimal)objects[0], (decimal)objects[1], sender, (AtomusPageEventArgs)objects[2], true);

                    break;

                case "UserControl.GetControl":
                    objects = (object[])e.Value;    //_MENU_ID, _ASSEMBLY_ID, sender, AtomusControlArgs

                    e.Value = this.OpenControl((decimal)objects[0], (decimal)objects[1], sender, (AtomusPageEventArgs)objects[2], false);

                    break;

                    //case "UserControl.AssemblyVersionCheck":
                    //    tmp = this.GetAttribute("ProcedureAssemblyVersionCheck");

                    //    if (tmp != null && tmp.Trim() != "")
                    //    {
                    //        response = this.AssemblyVersionCheck(sender);

                    //        if (response.Status != Service.Status.OK)
                    //        {
                    //            this.MessageBoxShow(this, response.Message);
                    //            e.Value = false;
                    //        }
                    //        else
                    //            e.Value = true;
                    //    }
                    //    else
                    //        e.Value = true;

                    //    break;

                    //default:
                    //    throw new AtomusException("'{0}'은 처리할 수 없는 Action 입니다.".Translate(e.Action));
                }
            }
            catch (Exception exception)
            {
                await DisplayAlert("Exception", exception.Message, "OK");
            }
        }
        private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            AtomusPageEventArgs atomusPageEventArgs;

            try
            {
                var item = e.SelectedItem as MenuItem;

                if (item == null)
                {
                    return;
                }

                if (sender != null && sender is ListView)
                {
                    (sender as ListView).SelectedItem = null;
                }

                if (item.AssemblyID < 0)
                {
                    return;
                }

                if (item.Page == null)
                {
                    atomusPageEventArgs = new AtomusPageEventArgs("Menu.OpenControl", new object[] { item.MenuID, item.AssemblyID, item.VisibleOne });

                    this.afterActionEventHandler?.Invoke(this, atomusPageEventArgs);

                    if (atomusPageEventArgs.Value != null && atomusPageEventArgs.Value is Xamarin.Forms.Page)
                    {
                        item.Page       = (Xamarin.Forms.Page)atomusPageEventArgs.Value;
                        item.Page.Title = item.Title;
                    }
                }

                this.afterActionEventHandler?.Invoke(this, new AtomusPageEventArgs("Menu.Select", item.Page));
            }
            catch (Exception ex)
            {
                Diagnostics.DiagnosticsTool.MyTrace(ex);
            }
        }
示例#3
0
        private void MasterPage_AfterActionEventHandler(ICore sender, AtomusPageEventArgs e)
        {
            ICore core;

            object[]           objects;
            Xamarin.Forms.Page page;

            switch (e.Action)
            {
            case "Menu.Select":
                core = (ICore)e.Value;

                page = (Xamarin.Forms.Page)e.Value;

                var existingPages = ((NavigationPage)Detail).Pages.ToList();

                if (existingPages.Contains(page))
                {
                    for (int i = existingPages.Count - 1; i >= 0; i--)
                    {
                        if (existingPages[i].Equals(page))
                        {
                            break;
                        }
                        else
                        {
                            ((NavigationPage)Detail).PopAsync();
                        }
                    }
                }
                else
                {
                    ((NavigationPage)Detail).PushAsync((Xamarin.Forms.Page)e.Value, false);
                }

                IsPresented = false;
                break;

            case "Menu.OpenControl":
                objects = (object[])e.Value; //_MENU_ID, _ASSEMBLY_ID, _VisibleOne

                if ((bool)objects[2])        //_VisibleOne
                {
                    //foreach (TabPage _TabPage in this.tabControl.TabPages)
                    //{
                    //    core = (ICore)_TabPage.Tag;

                    //    MENU_ID = core.GetAttribute("MENU_ID");

                    //    if (MENU_ID != null)
                    //        if (MENU_ID.Equals(objects[0].ToString()))
                    //        {
                    //            this.tabControl.Tag = _TabPage.Tag;
                    //            this.tabControl.SelectedTab = _TabPage;
                    //            return;//기존 화면이 있으니 바로 빠져 나감
                    //        }
                    //}
                }

                e.Value = this.OpenControl((decimal)objects[0], (decimal)objects[1], sender, null, true);

                break;
            }
        }
示例#4
0
 private void MasterPage_BeforeActionEventHandler(ICore sender, AtomusPageEventArgs e)
 {
 }
示例#5
0
 private void Home_AfterActionEventHandler(ICore sender, AtomusPageEventArgs e)
 {
 }
示例#6
0
 private void UserControl_BeforeActionEventHandler(ICore sender, AtomusPageEventArgs e)
 {
 }
示例#7
0
        private ICore OpenControl(decimal _MENU_ID, decimal _ASSEMBLY_ID, ICore sender, AtomusPageEventArgs _AtomusControlEventArgs, bool addTabControl)
        {
            Service.IResponse _Result;
            IAction           _Core;

            try
            {
                _Result = this.SearchOpenControl(new DefaultBrowserSearchModel()
                {
                    MENU_ID     = _MENU_ID,
                    ASSEMBLY_ID = _ASSEMBLY_ID
                });

                if (_Result.Status == Service.Status.OK)
                {
                    if (_Result.DataSet.Tables.Count == 2)
                    {
                        if (_Result.DataSet.Tables[0].Rows.Count == 1)
                        {
                            //switch (_ASSEMBLY_ID)
                            //{
                            //    //case 5:
                            //    //    _Core = new Atomus.AutoKing.Page.AccountStandard();//  ▶ 계정
                            //    //    break;

                            //    //case 12:
                            //    //    _Core = new Atomus.AutoKing.Page.CM02();//▶ 수익 & 랭킹
                            //    //    break;

                            //    //case 15:
                            //    //    _Core = new Atomus.AutoKing.Page.CM05();//▶ 자산 변동
                            //    //    break;

                            //    //case 11:
                            //    //    _Core = new Atomus.AutoKing.Page.CM03();//  ▶ 스켈핑(서버)
                            //    //    break;

                            //    //case 13:
                            //    //    _Core = new Atomus.AutoKing.Page.CM04();//  ▶ 포인트 관리
                            //    //    break;

                            //    //case 14:
                            //    //    _Core = new Atomus.AutoKing.Page.CM11();//  ▶ 환경 설정
                            //    //    break;

                            //    //case 16:
                            //    //    _Core = new Atomus.AutoKing.Page.CM15();//  ▶ AutoKing Info
                            //    //    break;

                            //    //case 9:
                            //    //    _Core = new Atomus.AutoKing.Page.CM21();//  ▶ 입금, 출금 조회
                            //    //    break;

                            //    //case 7:
                            //    //    _Core = new Atomus.AutoKing.Page.CM22();//  ▶ 자동매매 서버(스켈핑) 관리
                            //    //    break;

                            //    default:
                            //        if (_Result.DataSet.Tables[0].Columns.Contains("FILE_TEXT") && _Result.DataSet.Tables[0].Rows[0]["FILE_TEXT"] != DBNull.Value)
                            //            _Core = (IAction)Factory.CreateInstance(Convert.FromBase64String((string)_Result.DataSet.Tables[0].Rows[0]["FILE_TEXT"]), _Result.DataSet.Tables[0].Rows[0]["NAMESPACE"].ToString(), false, false);
                            //        else
                            //            _Core = (IAction)Factory.CreateInstance((byte[])_Result.DataSet.Tables[0].Rows[0]["FILE"], _Result.DataSet.Tables[0].Rows[0]["NAMESPACE"].ToString(), false, false);

                            //        break;
                            //}

                            _Core = (IAction)Config.Client.GetAttribute("DebugPage");
                            if (_Core != null && _Core.GetAttributeDecimal("ASSEMBLY_ID") == _ASSEMBLY_ID)
                            {
                            }
                            else
                            {
                                if (_Result.DataSet.Tables[0].Columns.Contains("FILE_TEXT") && _Result.DataSet.Tables[0].Rows[0]["FILE_TEXT"] != DBNull.Value)
                                {
                                    _Core = (IAction)Factory.CreateInstance(Convert.FromBase64String((string)_Result.DataSet.Tables[0].Rows[0]["FILE_TEXT"]), _Result.DataSet.Tables[0].Rows[0]["NAMESPACE"].ToString(), false, false);
                                }
                                else
                                {
                                    _Core = (IAction)Factory.CreateInstance((byte[])_Result.DataSet.Tables[0].Rows[0]["FILE"], _Result.DataSet.Tables[0].Rows[0]["NAMESPACE"].ToString(), false, false);
                                }

                                _Core.SetAttribute("MENU_ID", _MENU_ID.ToString());
                                _Core.SetAttribute("ASSEMBLY_ID", _ASSEMBLY_ID.ToString());
                            }

                            _Core.BeforeActionEventHandler += UserControl_BeforeActionEventHandler;
                            _Core.AfterActionEventHandler  += UserControl_AfterActionEventHandler;

                            foreach (System.Data.DataRow _DataRow in _Result.DataSet.Tables[1].Rows)
                            {
                                _Core.SetAttribute(_DataRow["ATTRIBUTE_NAME"].ToString(), _DataRow["ATTRIBUTE_VALUE"].ToString());
                            }

                            if (_AtomusControlEventArgs != null)
                            {
                                _Core.ControlAction(sender, _AtomusControlEventArgs.Action, _AtomusControlEventArgs.Value);
                            }

                            return(_Core);
                        }
                    }
                }
                else
                {
                    DisplayAlert("Warning", _Result.Message, "OK");
                }

                return(null);
            }
            catch (Exception _Exception)
            {
                DisplayAlert("Exception", _Exception.Message, "OK");
                return(null);
            }
            finally
            {
            }
        }