Пример #1
0
        private void JoinControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
        {
            try
            {
                switch (e.Action)
                {
                case "DragMove":
                    this.DragMove();
                    break;

                case "Form.Size":
                    this.Width  = ((Size)e.Value).Width;
                    this.Height = ((Size)e.Value).Height;

                    ((UserControl)this.loginControl).Width  = this.Width;
                    ((UserControl)this.loginControl).Height = this.Height;
                    break;

                case "Join.Cancel":
                    this.SetLoginControl();
                    break;

                default:
                    throw new AtomusException((this).GetMessage("Common", "00047", "'{0}'은(는) 처리할 수 없는 {1} 입니다.").Message.Translate(e.Action, "Action"));
                    //throw new AtomusException("'{0}'은 처리할 수 없는 Action 입니다.".Translate(e.Action));
                }
            }
            catch (Exception ex)
            {
                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
        }
Пример #2
0
        private void UserControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
        {
            object[]          objects;
            Service.IResponse response;
            string            tmp;

            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, (AtomusControlEventArgs)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, (AtomusControlEventArgs)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, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //                e.Value = false;
                //            }
                //            else
                //                e.Value = true;
                //        }
                //        else
                //            e.Value = true;

                //        break;


                //    case "UserControl.Status":
                //        objects = (object[])e.Value;//StatusBarInfomation1  Text

                //        this.ribbon.Items[string.Format("RibbonStatusBar_{0}", objects[0])].Caption = (string)objects[1];

                //        break;

                //        //default:
                //        //    throw new AtomusException("'{0}'은 처리할 수 없는 Action 입니다.".Translate(e.Action));
                //}
            }
            catch (Exception exception)
            {
                //this.MessageBoxShow(this, exception);
            }
        }
Пример #3
0
        object IAction.ControlAction(ICore sender, AtomusControlArgs e)
        {
            AtomusControlEventArgs atomusControlEventArgs;

            try
            {
                this.beforeActionEventHandler?.Invoke(this, e);

                switch (e.Action)
                {
                case "Email.Focus":
                    this.Email.Focus();
                    return(true);

                case "AccessNumber.Focus":
                    this.AccessNumber.Focus();
                    return(true);

                case "Form.Size":
                    if (this.Background == null)    //이미지를 늦게 불러오는 경우에 다시 반영
                    {
                        this.Background = (this.DataContext as ViewModel.DefaultLoginViewModel).BackgroundImage;
                    }
                    return(true);

                case "Login.Cancel":
                    return(true);

                case "Opacity.Set":
                    return(true);

                case "Opacity.Get":
                    atomusControlEventArgs = new AtomusControlEventArgs("Opacity.Get", null);
                    this.afterActionEventHandler?.Invoke(this, atomusControlEventArgs);

                    return(atomusControlEventArgs.Value);

                case "Login.Ok":
                    return(true);

                case "Login.JoinOrAccessNumberChange":
                    return(true);

                case "Login.LanguageSelected":
                    this.Translator().Restoration(this);
                    this.Translator().Translate(this);
                    return(true);

                default:
                    throw new AtomusException("'{0}'은 처리할 수 없는 Action 입니다.".Translate(e.Action));
                }
            }
            finally
            {
                if (!new string[] { "Email.Focus", "AccessNumber.Focus", "Opacity.Get", "Login.LanguageSelected" }.Contains(e.Action))
                {
                    this.afterActionEventHandler?.Invoke(this, e);
                }
            }
        }
Пример #4
0
        private void UserControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
        {
            object[] objects;
            IAction  core;
            AtomusControlEventArgs atomusControlEventArgs;

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

                    core = (this.DataContext as ViewModel.ModernBrowserViewModel).OpenControlProcess((decimal)objects[0], (decimal)objects[1]);

                    e.Value = core;

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

                    this.AddTabItem(core.GetAttribute("NAME"), core.GetAttribute("DESCRIPTION"), core);

                    if (objects.Length >= 3 && objects[2] != null && objects[2] is AtomusControlEventArgs)
                    {
                        atomusControlEventArgs = objects[2] as AtomusControlEventArgs;
                        core.ControlAction(sender, atomusControlEventArgs.Action, atomusControlEventArgs.Value);
                    }

                    break;

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

                    core = (this.DataContext as ViewModel.ModernBrowserViewModel).OpenControlProcess((decimal)objects[0], (decimal)objects[1]);

                    e.Value = core;

                    if (objects.Length >= 3 && objects[2] != null && objects[2] is AtomusControlEventArgs)
                    {
                        atomusControlEventArgs = objects[2] as AtomusControlEventArgs;
                        core.ControlAction(sender, atomusControlEventArgs.Action, atomusControlEventArgs.Value);
                    }

                    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, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    //            e.Value = false;
                    //        }
                    //        else
                    //            e.Value = true;
                    //    }
                    //    else
                    //        e.Value = true;

                    //    break;


                    //case "UserControl.Status":
                    //    objects = (object[])e.Value;//StatusBarInfomation1  Text

                    //    this.ribbon.Items[string.Format("RibbonStatusBar_{0}", objects[0])].Caption = (string)objects[1];

                    //    break;

                    //    //default:
                    //    //    throw new AtomusException("'{0}'은 처리할 수 없는 Action 입니다.".Translate(e.Action));
                }
            }
            catch (Exception exception)
            {
                (this).WindowsMessageBoxShow(Application.Current.Windows[0], exception);
            }
        }
Пример #5
0
 private void UserControl_BeforeActionEventHandler(ICore sender, AtomusControlEventArgs e)
 {
 }
Пример #6
0
 private void HomeControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
 {
     //throw new NotImplementedException();
 }
Пример #7
0
        private async void MenuControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
        {
            object[] objects;
            IAction  core;
            string   MENU_ID;

            try
            {
                switch (e.Action)
                {
                case "Menu.MenuFolding":
                    objects = (object[])e.Value;    // true:Fold, else:Expand
                    switch ((bool?)objects[0])
                    {
                    case true:
                        this.gridCenter.ColumnDefinitions[0].Width = new GridLength(62);
                        break;

                    default:
                        this.gridCenter.ColumnDefinitions[0].Width = new GridLength(290);
                        break;
                    }
                    break;

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

                    if ((bool)objects[2])        //_VisibleOne
                    {
                        foreach (TabItem tabItem in this.tabControl.Items)
                        {
                            if (tabItem.Tag == null)
                            {
                                continue;
                            }

                            core = (IAction)tabItem.Tag;


                            MENU_ID = core.GetAttribute("MENU_ID");

                            if (MENU_ID != null)
                            {
                                if (MENU_ID.Equals(objects[0].ToString()))
                                {
                                    this.Tag = tabItem.Tag;
                                    this.tabControl.SelectedItem = tabItem;

                                    return;    //기존 화면이 있으니 바로 빠져 나감
                                }
                            }
                        }
                    }

                    core = await(this.DataContext as ViewModel.ModernBrowserViewModel).OpenControlAsyncProcess((decimal)objects[0], (decimal)objects[1]);

                    e.Value = core;

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

                    this.AddTabItem(core.GetAttribute("NAME"), core.GetAttribute("DESCRIPTION"), core);

                    break;

                default:
                    throw new AtomusException((this).GetMessage("Common", "00047", "'{0}'은(는) 처리할 수 없는 {1} 입니다.").Message.Translate(e.Action, "Action"));
                    //throw new AtomusException("'{0}'은 처리할 수 없는 Action 입니다.".Translate(e.Action));
                }
            }
            catch (Exception ex)
            {
                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
        }
Пример #8
0
        private void ToolbarControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
        {
            IAction action;
            TabItem tabItem;
            AtomusControlEventArgs atomusControlEventArgs;

            try
            {
                action = (IAction)this.Tag;

                switch (e.Action)
                {
                case "Menu.TopMenuSelected":
                    this.menuControl.ControlAction(sender, e.Action, e.Value);
                    break;


                case "Close":
                    if (!action.Equals(this.homeControl) && this.tabControl.SelectedItem != null && this.tabControl.SelectedItem is TabItem)
                    {
                        tabItem = (TabItem)this.tabControl.SelectedItem;
                        //this.tabControl.DeselectTab(tabPage);

                        if (action.GetAttribute("AllowCloseAction") != null && action.GetAttribute("AllowCloseAction") == "Y")
                        {
                            try
                            {
                                if (!(bool)(action).ControlAction(this, new AtomusControlArgs(e.Action, null)))
                                {
                                    e.Value = false;
                                    return;
                                }
                            }
                            catch (Exception ex)
                            {
                                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
                                e.Value = false;
                                return;
                            }
                        }

                        this.tabControl.Items.Remove(tabItem);

                        if (action is System.Windows.Forms.UserControl)
                        {
                            (action as System.Windows.Forms.UserControl).Dispose();
                        }

                        e.Value = true;
                    }
                    else
                    {
                        this.Close();
                    }

                    break;

                case "FullWindowsMode":
                    if (this.gridCenter.ColumnDefinitions[0].Width.Value <= this.gridSplitter.Width)
                    {
                        this.gridCenter.ColumnDefinitions[0].Width = new GridLength(oldGridSplitterWidth);
                    }
                    else
                    {
                        this.oldGridSplitterWidth = this.gridCenter.ColumnDefinitions[0].Width.Value;
                        this.gridCenter.ColumnDefinitions[0].Width = new GridLength(this.gridSplitter.Width);
                    }

                    if (this.gridCenter.ColumnDefinitions[0].Width.Value <= this.gridSplitter.Width)
                    {
                        this.gridCenter.ColumnDefinitions[0].Width = new GridLength(this.gridSplitter.Width);
                    }

                    break;

                case "Form.Size":
                    this.Width  = ((Size)e.Value).Width;
                    this.Height = ((Size)e.Value).Height;

                    ((UserControl)this.loginControl).Width  = this.Width;
                    ((UserControl)this.loginControl).Height = this.Height;
                    break;

                case "Join.Cancel":
                    this.SetLoginControl();
                    break;

                default:
                    if (!e.Action.StartsWith("Action."))
                    {
                        if (!sender.Equals(this.toolbarControl))    //toolbarControl 아니면?(기본 툴바 버튼이면)
                        {
                            action = (IAction)sender;
                        }

                        if (sender.GetAttribute("ASSEMBLY_ID") != null)
                        {
                            atomusControlEventArgs = new AtomusControlEventArgs("UserControl.AssemblyVersionCheck", null);
                            this.UserControl_AfterActionEventHandler(action, atomusControlEventArgs);

                            if ((bool)atomusControlEventArgs.Value)
                            {
                                action.ControlAction(sender, e.Action, e.Value);
                                return;
                            }
                        }
                        else
                        {
                            action.ControlAction(sender, e.Action, e.Value);
                        }
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
        }
Пример #9
0
        private void LoginControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
        {
            try
            {
                switch (e.Action)
                {
                case "DragMove":
                    this.DragMove();
                    break;

                case "Opacity.Set":
                    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new System.Action(delegate
                    {
                        (this.DataContext as ViewModel.ModernBrowserViewModel).Opacity = (double)e.Value;
                    }));
                    break;

                case "Opacity.Get":
                    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new System.Action(delegate
                    {
                        e.Value = (this.DataContext as ViewModel.ModernBrowserViewModel).Opacity;
                    }));
                    break;

                case "Form.Size":
                    this.Width  = ((Size)e.Value).Width;
                    this.Height = ((Size)e.Value).Height;

                    ((UserControl)this.loginControl).Width  = this.Width;
                    ((UserControl)this.loginControl).Height = this.Height;
                    break;

                case "Login.Ok":
                    this.Style = this.DefaultWindowStyle;

                    (this.DataContext as ViewModel.ModernBrowserViewModel).Opacity = 0;

                    this.gridLayout.Children.Remove((UserControl)this.loginControl);

                    //this.ControlBox = true;
                    this.ShowInTaskbar = true;

                    this.WindowStyle = WindowStyle.SingleBorderWindow;

                    //this.AllowsTransparency = false;
                    this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    this.Topmost = false;

                    //this.WindowState = WindowState.Maximized;
                    //this.WindowState = WindowState.Normal;
                    //this.WindowState = WindowState.Maximized;

                    //try
                    //{
                    //    this.Icon = await this.GetAttributeMediaWebImage("Icon");
                    //}
                    //catch (Exception _Exception)
                    //{
                    //    DiagnosticsTool.MyTrace(_Exception);
                    //}

                    this.ResizeMode = ResizeMode.CanResizeWithGrip;

                    this.Style = null;
                    this.Style = this.DefaultWindowStyle;

                    //(this.DataContext as ViewModel.ModernBrowserViewModel).UserID = null;

                    this.SetBrowserViewer();

                    this.SetToolbar();

                    //this.SetStatusBar();

                    this.SetCenter();

                    this.SetMenu();

                    if (this.toolbarControl != null)
                    {
                        this.toolbarControl.ControlAction(this, "Menu.TopMenu", this.menuControl?.ControlAction(this, "Menu.TopMenu", null));
                    }

                    this.gridSplitter = new GridSplitter()
                    {
                        Width = 5,
                        HorizontalAlignment = HorizontalAlignment.Right,
                        VerticalAlignment   = VerticalAlignment.Stretch,
                        ResizeBehavior      = GridResizeBehavior.CurrentAndNext,
                        Background          = new SolidColorBrush("#2a3344".ToMediaColor())
                    };
                    this.gridCenter.Children.Add(this.gridSplitter);

                    this.SetTabControl();

                    this.AddHomeControl();

                    //this.SetStatusStrip();

                    //(this.DataContext as ViewModel.ModernBrowserViewModel).Opacity = 1;

                    //this.FormClosing -= new FormClosingEventHandler(this.DefaultBrowser_FormClosing);
                    break;

                case "Login.Cancel":
                    //this.Style = this.DefaultWindowStyle;
                    this.Close();
                    break;

                case "Login.JoinOrAccessNumberChange":
                    this.SetJoinControl();
                    break;

                default:
                    throw new AtomusException((this).GetMessage("Common", "00047", "'{0}'은(는) 처리할 수 없는 {1} 입니다.").Message.Translate(e.Action, "Action"));
                    //throw new AtomusException("'{0}'은 처리할 수 없는 Action 입니다.".Translate(e.Action));
                }
            }
            catch (Exception ex)
            {
                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
        }
        private void ToolbarControl_AfterActionEventHandler(ICore sender, AtomusControlEventArgs e)
        {
            IAction action;
            TabItem tabItem;
            AtomusControlEventArgs atomusControlEventArgs;

            try
            {
                action = (IAction)this.Tag;

                switch (e.Action)
                {
                case "Close":
                    if (this.tabControl.SelectedItem != null && this.tabControl.SelectedItem is TabItem)
                    {
                        tabItem = (TabItem)this.tabControl.SelectedItem;
                        //this.tabControl.DeselectTab(tabPage);

                        if (action.GetAttribute("AllowCloseAction") != null && action.GetAttribute("AllowCloseAction") == "Y")
                        {
                            try
                            {
                                if (!(bool)(action).ControlAction(this, new AtomusControlArgs(e.Action, null)))
                                {
                                    e.Value = false;
                                    return;
                                }
                            }
                            catch (Exception ex)
                            {
                                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
                                e.Value = false;
                                return;
                            }
                        }

                        this.tabControl.Items.Remove(tabItem);

                        if (action is System.Windows.Forms.UserControl)
                        {
                            (action as System.Windows.Forms.UserControl).Dispose();
                        }

                        e.Value = true;
                    }
                    else
                    {
                        this.Close();
                    }

                    break;

                case "SetActionButtons.Complete":
                    (Application.Current as IAction).ControlAction(this, "AddUserControl");
                    break;


                default:
                    if (!e.Action.StartsWith("Action."))
                    {
                        if (!sender.Equals(this.toolbarControl))    //toolbarControl 아니면?(기본 툴바 버튼이면)
                        {
                            action = (IAction)sender;
                        }

                        if (sender.GetAttribute("ASSEMBLY_ID") != null)
                        {
                            atomusControlEventArgs = new AtomusControlEventArgs("UserControl.AssemblyVersionCheck", null);
                            this.UserControl_AfterActionEventHandler(action, atomusControlEventArgs);

                            if ((bool)atomusControlEventArgs.Value)
                            {
                                action.ControlAction(sender, e.Action, e.Value);
                                return;
                            }
                        }
                        else
                        {
                            action?.ControlAction(sender, e.Action, e.Value);
                        }
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
        }