Exemplo n.º 1
0
        private async void GetBackgroundImage()
        {
            ImageSource image;

            try
            {
                image = await this.Core.GetAttributeMediaWebImage("BackgroundImage");

                this.backgroundImage = new ImageBrush(image);

                if (this.backgroundImage != null)
                {
                    (this.Core as IAction).ControlAction(this, new AtomusControlArgs("Form.Size", new System.Windows.Size(image.Width, image.Height)));
                }
            }
            catch (Exception exception)
            {
                DiagnosticsTool.MyTrace(exception);
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
#if DEBUG
                DiagnosticsTool.MyDebug(string.Format("DefaultBrowser_Load(object sender = {0}, EventArgs e = {1})", (sender != null) ? sender.ToString() : "null", (e != null) ? e.ToString() : "null"));
#endif
                //this.Width = 0;
                //this.Height = 0;
                (this.DataContext as ViewModel.ModernBrowserDebugViewModel).Title = Factory.FactoryConfig.GetAttribute("Atomus", "ServiceName");

                (Application.Current as IAction).ControlAction(this, "Login");
                //beforeActionEventHandler.Invoke(this, new AtomusControlEventArgs() { Action = "Login" });

                this.SetBrowserViewer();

                this.SetToolbar();

                this.SetCenter();

                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();

                //(Application.Current as IAction).ControlAction(this, "AddUserControl");
                //beforeActionEventHandler.Invoke(this, new AtomusControlEventArgs() { Action = "AddUserControl" });
            }
            catch (Exception ex)
            {
                (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
                Application.Current.Shutdown();
            }
        }
Exemplo n.º 3
0
        public DefaultMessage()
        {
            IResponse response;

            if (dataTable == null)
            {
                try
                {
                    response = this.Search();

                    if (response.Status == Status.OK)
                    {
                        dataTable = response.DataSet.Tables[0];
                    }
                }
                catch (Exception ex)
                {
                    DiagnosticsTool.MyTrace(ex);
                }
            }
        }
Exemplo n.º 4
0
        private void SetLanguageList()
        {
            string[] tmps;

            try
            {
                this.languageList = new List <string>();

                var cultureNames = from Cultures in CultureInfo.GetCultures(CultureTypes.AllCultures)
                                   where Cultures.Name.Contains("-")
                                   orderby Cultures.Name
                                   select Cultures.Name;

                if (this.Core.GetAttribute("LanguageList") != null && this.Core.GetAttribute("LanguageList") != "")
                {
                    tmps = this.Core.GetAttribute("LanguageList").Split(',');

                    foreach (string name in tmps)
                    {
                        this.languageList.Add(name);
                    }
                }
                else
                {
                    foreach (string name in cultureNames)
                    {
                        this.languageList.Add(name);
                    }
                }

                this.languageList.Add("");
                //if (Properties.Settings.Default.Language.Equals(""))
                //    this.languageSelected = CultureInfo.CurrentCulture.Name;
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
                //this.WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
        }
        void ITranslator.Restoration(System.Windows.Forms.Control control)
        {
            if (this.controls.ContainsKey(control))
            {
                if (control.Controls != null && control.Controls.Count > 0)
                {
                    ((ITranslator)this).Restoration(control.Controls);
                }

                //Text 속석을 사용 할 수 없는 컨트롤도 있음
                try
                {
                    control.Text = this.controls[control];
                }
                catch (Exception _Exception)
                {
                    DiagnosticsTool.MyTrace(_Exception);
                }

                this.controls.Remove(control);
            }
        }
Exemplo n.º 6
0
        private void DefaultBrowser_KeyDown1(object sender, KeyEventArgs e)
        {
            if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.F4)
            {
                try
                {
                    this.ToolbarControl_AfterActionEventHandler(toolbarControl, new AtomusControlArgs("Close", null));
                    //((IAction)this).ControlAction(_ToolbarControl, ));
                }
                catch (Exception ex)
                {
                    (this).WindowsMessageBoxShow(Application.Current.Windows[0], ex);
                }
            }

            if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Tab && FocusManager.GetFocusedElement(this) != this.tabControl)
            {
                if (this.tabControl.SelectedIndex + 1 == this.tabControl.Items.Count)
                {
                    this.tabControl.SelectedIndex = 0;
                }
                else
                {
                    this.tabControl.SelectedIndex += 1;
                }
            }

#if DEBUG
            if (Keyboard.Modifiers == ModifierKeys.Control && Keyboard.Modifiers == ModifierKeys.Shift && e.Key == Key.D)
            {
                DiagnosticsTool.ShowForm();
            }
#endif

            if (Keyboard.Modifiers == ModifierKeys.Control && Keyboard.Modifiers == ModifierKeys.Shift && e.Key == Key.T)
            {
                DiagnosticsTool.ShowForm();
            }
        }
Exemplo n.º 7
0
        private async void SearchProcess(decimal MENU_ID, decimal PARENT_MENU_ID)
        {
            Service.IResponse result;

            try
            {
                this.IsEnabledControl = false;
                (this.SearchCommand as Atomus.MVVM.DelegateCommand).RaiseCanExecuteChanged();

                result = await this.Core.SearchAsync(new DefaultMenuSearchModel()
                {
                    START_MENU_ID       = MENU_ID,
                    ONLY_PARENT_MENU_ID = PARENT_MENU_ID
                });

                if (result.Status == Service.Status.OK)
                {
                    this.MenuData = null;
                    if (result.DataSet != null && result.DataSet.Tables.Count > 0)
                    {
                        this.MenuData = await this.SetTree(result.DataSet.Tables[1]);
                    }
                }
                else
                {
                    this.WindowsMessageBoxShow(Application.Current.Windows[0], result.Message, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                }
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
                //this.WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
            finally
            {
                this.IsEnabledControl = true;
                (this.SearchCommand as Atomus.MVVM.DelegateCommand).RaiseCanExecuteChanged();
            }
        }
Exemplo n.º 8
0
        public DefaultLoginViewModel(ICore core) : this()
        {
            System.Drawing.Point point;

            this.Core = core;

            try
            {
                point = this.Core.GetAttributePoint("LoginControlLocation");

                this.loginControlLocationX = point.X;
                this.loginControlLocationY = point.Y;

                if (this.Core.GetAttribute("EnableJoin") != null && this.Core.GetAttribute("EnableJoin").Equals("Y"))
                {
                    this.joinVisibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.joinVisibility = System.Windows.Visibility.Hidden;
                }

                this.backColor         = this.Core.GetAttribute("LoginControlBackColor");
                this.foreColor         = this.Core.GetAttribute("LoginControlForeColor");
                this.buttonBorderColor = this.Core.GetAttribute("ButtonBorderColor");

                this.GetBackgroundImage();
                this.SetLanguageList();
                this.ReadSSO();

                this.isEnabledIsEmailSaveControl = true;
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
                //this.WindowsMessageBoxShow(Application.Current.Windows[0], ex);
            }
        }
Exemplo n.º 9
0
        private void GetActivationUri()
        {
            string tmp;

            string[] tmps;
            string[] tmps1;

            try
            {
                if (ApplicationDeployment.IsNetworkDeployed)
                {
                    tmp = ApplicationDeployment.CurrentDeployment.ActivationUri.Query;

                    if (!tmp.IsNullOrEmpty() && tmp.Contains("?"))
                    {
                        tmps = tmp.Substring(tmp.IndexOf('?') + 1).Split('&');

                        foreach (string value in tmps)
                        {
                            if (value.Contains("="))
                            {
                                tmps1 = value.Split('=');

                                if (tmps1.Length > 1)
                                {
                                    Config.Client.SetAttribute(string.Format("UriParameter.{0}", tmps1[0]), tmps1[1]);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
            }
        }
Exemplo n.º 10
0
        public EditorTools(object owner)
        {
            Owner          = owner;
            Textures       = new TextureTool();
            Segments       = new SegmentTool();
            Walls          = new WallTool();
            Triggers       = new TriggerTool();
            Objects        = new ObjectTool();
            Effects        = new EffectTool();
            Lights         = new LightsTool();
            Reactor        = new ReactorTool();
            Mission        = new MissionTool();
            Diagnostics    = new DiagnosticsTool();
            TextureFilters = new TextureFiltersTab();
            Settings       = new SettingsTool();

            AllTools = new DLELayoutableUserControl[] { Textures, Segments, Walls, Triggers, Objects, Effects, Lights, Reactor, Mission, Diagnostics, TextureFilters, Settings };
            attached = attachedToFloating = false;

            foreach (DLELayoutableUserControl tab in AllTools)
            {
                tab.Owner = (EditorWindow)owner;
            }
        }
        public async void SetActionButtons()
        {
            string tmp;
            string tmpImgae;
            string tmpImgaeOver;
            string tmpImgaePressed;

            string[]            buttons;
            string[]            iswindowscontrol;
            List <ActionButton> actionButton;

            try
            {
                this.IsSetActionButtons = true;
                actionButton            = new List <ActionButton>();

                tmp = this.Core.GetAttribute("Buttons");

                if (tmp.IsNullOrEmpty())
                {
                    return;
                }

                buttons = tmp.Split(',');

                tmp = this.Core.GetAttribute("ButtonsWIndowsControl");

                if (tmp.IsNullOrEmpty())
                {
                    return;
                }

                iswindowscontrol = tmp.Split(',');

                foreach (string bnt in buttons)
                {
                    tmpImgae        = this.Core.GetAttribute(string.Format("{0}.Image", bnt));
                    tmpImgaeOver    = this.Core.GetAttribute(string.Format("{0}.ImageOver", bnt));
                    tmpImgaePressed = this.Core.GetAttribute(string.Format("{0}.ImagePressed", bnt));

                    actionButton.Add(new ActionButton()
                    {
                        Name             = bnt,
                        Text             = this.Core.GetAttribute(string.Format("{0}.Text", bnt)),
                        Visibility       = iswindowscontrol.Contains(bnt) ? Visibility.Collapsed : Visibility.Visible,
                        IsWindowsControl = iswindowscontrol.Contains(bnt),
                        Image            = !tmpImgae.IsNullOrEmpty()
                                                    ? (tmpImgae.Contains("http")
                                                        ? await this.Core.GetAttributeMediaWebImage(new Uri(tmpImgae))
                                                        : await this.Core.GetAttributeMediaWebImage(string.Format("{0}.Image", bnt)))
                                                    : null,
                        ImageOver = !tmpImgaeOver.IsNullOrEmpty()
                                                    ? (tmpImgaeOver.Contains("http")
                                                        ? await this.Core.GetAttributeMediaWebImage(new Uri(tmpImgaeOver))
                                                        : await this.Core.GetAttributeMediaWebImage(string.Format("{0}.ImageOver", bnt)))
                                                    : null,
                        ImagePressed = !tmpImgaePressed.IsNullOrEmpty()
                                                    ? (tmpImgaePressed.Contains("http")
                                                        ? await this.Core.GetAttributeMediaWebImage(new Uri(tmpImgaePressed))
                                                        : await this.Core.GetAttributeMediaWebImage(string.Format("{0}.ImagePressed", bnt)))
                                                    : null
                    }
                                     );
                }

                this.ActionButtons = actionButton;
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
            }
            finally
            {
                (this.Core as IAction).ControlAction(this, "SetActionButtons.Complete");
                this.IsSetActionButtons = false;
            }
        }
Exemplo n.º 12
0
        private void TimerFade_Tick(object sender, ElapsedEventArgs e)
        {
            Timer  timer;
            double opacity;

            timer = (Timer)sender;

            try
            {
                if (Config.Client.GetAttribute("Sessionkey") != null)
                {
                    timer?.Stop();

                    this.ControlAction(this, "Opacity.Set", 1D);

                    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new System.Action(delegate
                    {
                        (this.DataContext as ViewModel.ModernLoginViewModel).LoginCommand.Execute(null);
                    }));
                }
                else
                {
                    opacity = (double)this.ControlAction(this, "Opacity.Get", null);

                    if (this.isPadeIn)
                    {
                        if (opacity >= 1.0D)
                        {
                            timer.Enabled = false;

                            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new System.Action(delegate
                            {
                                if ((this.DataContext as ViewModel.ModernLoginViewModel).IsAutoLogin)
                                {
                                    if ((this.DataContext as ViewModel.ModernLoginViewModel).IsAutoLogin && this.WindowsMessageBoxShow(Application.Current.Windows[0], "자동로그인 하시겠습니까?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                                    {
                                        (this.DataContext as ViewModel.ModernLoginViewModel).LoginCommand.Execute(null);
                                    }
                                }
                            }));
                        }
                        else
                        {
                            this.ControlAction(this, "Opacity.Set", opacity += 0.01D);
                        }
                    }
                    else
                    {
                        if (opacity <= 0.0D)
                        {
                            timer?.Stop();
                        }
                        else
                        {
                            this.ControlAction(this, "Opacity.Set", opacity -= 0.01D);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                timer?.Stop();

                DiagnosticsTool.MyTrace(exception);

                try
                {
                    this.ControlAction(this, "Opacity.Set", 1.0D);
                }
                catch (Exception ex)
                {
                    DiagnosticsTool.MyTrace(ex);
                }
            }
        }
Exemplo n.º 13
0
        private bool LoadBizProxy(string bindingName, string bindingConfigName, string address)
        {
            Binding         binding;
            Uri             uri;
            ServiceEndpoint serviceEndpoint;
            ChannelFactory <IServiceExtensions> channelFactory;

            //ChannelFactory<IServiceAsync> _ChannelFactoryAsync;

            try
            {
                if (this.listServicePool.Count == 0)
                {
                    //this.LoadBinding();

                    this.LoadBinding(this.GetttributeInnerXml("system.serviceModel", 0));
                    //this.LoadBinding(Factory.FactoryConfig.XmlDocument.SelectNodes(this.GetType().FullName.Replace(".", "/") + "/system.serviceModel").Item(0).InnerXml);
                }

                switch (bindingName)
                {
                case "BasicHttpBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetBasicHttpBinding();
                    }
                    else
                    {
                        binding = this.GetBasicHttpBinding(bindingConfigName);
                    }
                    break;

                case "BasicHttpsBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetBasicHttpsBinding();
                    }
                    else
                    {
                        binding = this.GetBasicHttpsBinding(bindingConfigName);
                    }
                    break;

                case "CustomBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetCustomBinding();
                    }
                    else
                    {
                        binding = this.GetCustomBinding(bindingConfigName);
                    }
                    break;

                case "NetMsmqBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetNetMsmqBinding();
                    }
                    else
                    {
                        binding = this.GetNetMsmqBinding(bindingConfigName);
                    }
                    break;

                case "NetNamedPipeBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetNetNamedPipeBinding();
                    }
                    else
                    {
                        binding = this.GetNetNamedPipeBinding(bindingConfigName);
                    }
                    break;

                //case "NetPeerTcpBinding":
                //    binding = new NetPeerTcpBinding(bindingConfigName);
                //    ((NetPeerTcpBinding)binding).MaxReceivedMessageSize = 2147483647;
                //    break;

                case "NetTcpBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetNetTcpBinding();
                    }
                    else
                    {
                        binding = this.GetNetTcpBinding(bindingConfigName);
                    }
                    break;

                case "WSDualHttpBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetWSDualHttpBinding();
                    }
                    else
                    {
                        binding = this.GetWSDualHttpBinding(bindingConfigName);
                    }
                    break;

                case "WSHttpBinding":
                    if (bindingConfigName.IsNullOrEmpty())
                    {
                        binding = this.GetWSHttpBinding();
                    }
                    else
                    {
                        binding = this.GetWSHttpBinding(bindingConfigName);
                    }
                    break;

                default:
                    binding = null;
                    break;
                }

                try
                {
                    string[] tmps = this.GetAttribute("Timeout").Split(',');

                    int hours   = tmps[0].ToInt();
                    int minute  = tmps[1].ToInt();
                    int seconds = tmps[2].ToInt();

                    binding.OpenTimeout    = new TimeSpan(hours, minute, seconds);
                    binding.CloseTimeout   = new TimeSpan(hours, minute, seconds);
                    binding.SendTimeout    = new TimeSpan(hours, minute, seconds);
                    binding.ReceiveTimeout = new TimeSpan(hours, minute, seconds);
                }
                catch (Exception ex)
                {
                    binding.OpenTimeout    = new TimeSpan(0, 10, 0);
                    binding.CloseTimeout   = new TimeSpan(0, 10, 0);
                    binding.SendTimeout    = new TimeSpan(0, 10, 0);
                    binding.ReceiveTimeout = new TimeSpan(0, 10, 0);

                    DiagnosticsTool.MyTrace(ex);
                }

                //_Binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
                uri = new Uri(address);

                serviceEndpoint = new ServiceEndpoint(ContractDescription.GetContract(this.GetType()), binding, new EndpointAddress(uri));
                channelFactory  = new ChannelFactory <IServiceExtensions>(serviceEndpoint);
                //this.Service = _ChannelFactory.CreateChannel();

                //_ServiceEndpoint = new ServiceEndpoint(ContractDescription.GetContract(this.GetType()), _Binding, new EndpointAddress(_Uri));
                //_ChannelFactoryAsync = new ChannelFactory<IServiceAsync>(_ServiceEndpoint);
                //this.ServiceAsync = _ChannelFactoryAsync.CreateChannel();

                this.listServicePool.Add(new ServiceExtensionsInfo()
                {
                    ServiceExtensions = channelFactory.CreateChannel(),
                    IsBusy            = false
                });

                return(true);
            }
            catch (AtomusException exception)
            {
                throw exception;
            }
            catch (Exception exception)
            {
                throw new AtomusException(exception);
            }
        }
        private async void SetStyle(string skin)
        {
            System.Windows.Style style;
            ImageSource          image;


            foreach (var aa in this.ResourceDictionaryRoot.MergedDictionaries[0].Keys)
            {
                if (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] is System.Windows.Style &&
                    (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style).TargetType == typeof(Window) &&
                    !(aa is string))
                {
                    this.SetStyleWindow(skin, this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style, aa);
                }



                if (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] is System.Windows.Style &&
                    (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style).TargetType == typeof(UserControl) &&
                    (aa is string))
                {
                    this.SetStyleUserControl(skin, this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style, aa);
                }

                if (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] is System.Windows.Style &&
                    (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style).TargetType == typeof(Button) &&
                    (aa is string))
                {
                    this.SetStyleButton(skin, this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style, aa);
                }


                if (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] is System.Windows.Style &&
                    (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style).TargetType == typeof(TextBox) &&
                    (aa is string))
                {
                    ;
                }


                if (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] is System.Windows.Style &&
                    (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style).TargetType == typeof(Button) && !(aa is string))
                {
                    try
                    {
                        //image = await this.GetAttributeMediaWebImage("ImageTest");

                        //style = this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style;
                        //style.Setters.Add(new Setter(Button.BackgroundProperty, new ImageBrush(image)));

                        //Task t = new Task(async () =>
                        //{
                        //    image = await this.GetAttributeMediaWebImage("ImageTest");

                        //    style = this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style;
                        //    style.Setters.Add(new Setter(Button.BackgroundProperty, new ImageBrush(image)));
                        //});

                        //t.RunSynchronously();
                    }
                    catch (Exception exception)
                    {
                        DiagnosticsTool.MyTrace(exception);
                    }
                }
            }
        }
Exemplo n.º 15
0
        private void TimerFade_Tick(object sender, ElapsedEventArgs e)
        {
            Timer  timer;
            double opacity;

            timer = (Timer)sender;

            try
            {
                if (Config.Client.GetAttribute("Sessionkey") != null)
                {
                    timer?.Stop();

                    this.ControlAction(this, "Opacity.Set", 1D);

                    Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new System.Action(delegate
                    {
                        (this.DataContext as ViewModel.DefaultLoginViewModel).LoginCommand.Execute(null);
                    }));
                }
                else
                {
                    opacity = (double)this.ControlAction(this, "Opacity.Get", null);

                    if (this.isPadeIn)
                    {
                        if (opacity >= 1.0D)
                        {
                            timer.Enabled = false;
                            //this.IS_AUTO_LOGIN.Enabled = true;

                            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new System.Action(delegate
                            {
                                if ((this.DataContext as ViewModel.DefaultLoginViewModel).IsAutoLogin)
                                {
                                    if ((this.DataContext as ViewModel.DefaultLoginViewModel).IsAutoLogin && this.WindowsMessageBoxShow(Application.Current.Windows[0], "자동로그인 하시겠습니까?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                                    {
                                        (this.DataContext as ViewModel.DefaultLoginViewModel).LoginCommand.Execute(null);
                                    }
                                }

                                //(this.DataContext as ViewModel.DefaultLoginViewModel).IsEnabledControl = true;

                                //System.Collections.IEnumerator ts = Application.Current.Resources.Values.GetEnumerator();
                                //ts.MoveNext();

                                //Window window =  new Window()
                                //{
                                //    //Resources = Application.Current.Resources.Count,
                                //    //Style =  (System.Windows.Style)this.Current
                                //};

                                //StackPanel stackPanel =
                                //new StackPanel()
                                //{
                                //};

                                //stackPanel.Children.Add(new Label()
                                //{
                                //    Content = "12345"
                                //});

                                //window.Content = stackPanel;

                                //window.Show();
                            }));
                        }
                        else
                        {
                            this.ControlAction(this, "Opacity.Set", opacity += 0.01D);
                        }
                    }
                    else
                    {
                        if (opacity <= 0.0D)
                        {
                            timer?.Stop();
                        }
                        else
                        {
                            this.ControlAction(this, "Opacity.Set", opacity -= 0.01D);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                timer?.Stop();

                DiagnosticsTool.MyTrace(exception);

                try
                {
                    this.ControlAction(this, "Opacity.Set", 1.0D);
                }
                catch (Exception ex)
                {
                    DiagnosticsTool.MyTrace(ex);
                }
            }
        }
        private bool SetStyle0()
        {
            System.Windows.Style style;
            Task <ImageSource>   imageTask;
            ImageSource          image;



            foreach (var aa in this.ResourceDictionaryRoot.MergedDictionaries[0].Keys)
            {
                if (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] is System.Windows.Style && (this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style).TargetType == typeof(Button) && !(aa is string))
                {
                    try
                    {
                        //image = await this.GetAttributeMediaWebImage("ImageTest");

                        Task t = new Task(async() =>
                        {
                            image = await this.GetAttributeMediaWebImage("ImageTest");

                            style = this.ResourceDictionaryRoot.MergedDictionaries[0][aa] as System.Windows.Style;
                            style.Setters.Add(new Setter(Button.BackgroundProperty, new ImageBrush(image)));
                        });

                        t.RunSynchronously();
                    }
                    catch (Exception exception)
                    {
                        DiagnosticsTool.MyTrace(exception);
                        return(false);
                    }
                }
            }

            //foreach (var aa in this.Resources.MergedDictionaries[0].Values)
            //{
            //    if (aa is System.Windows.Style && (aa as System.Windows.Style).TargetType == typeof(Button))
            //    {
            //        try
            //        {
            //            //image = await this.GetAttributeMediaWebImage("ImageTest");

            //            Task t = new Task(async () =>
            //            {
            //                image = await this.GetAttributeMediaWebImage("ImageTest");

            //                style = aa as System.Windows.Style;
            //                style.Setters.Add(new Setter(Button.BackgroundProperty, new ImageBrush(image)));
            //            });

            //            t.RunSynchronously();

            //        }
            //        catch (Exception exception)
            //        {
            //            DiagnosticsTool.MyTrace(exception);
            //            return false;
            //        }

            //    }
            //}

            return(true);
        }
        void ITranslator.Translate(DependencyObject dependencyObject, string sourceCultureName, string targetCultureName)
        {
            foreach (System.Windows.Controls.Label label in dependencyObject.FindVisualChildren <System.Windows.Controls.Label>())
            {
                if (label.Content is string)
                {
                    if (!this.dependencyObjects.ContainsKey(label))
                    {
                        this.dependencyObjects.Add(label, (string)label.Content);
                    }


                    //Text 속석을 사용 할 수 없는 컨트롤도 있음
                    try
                    {
                        label.Content = ((ITranslator)this).Translate(this.dependencyObjects[label], sourceCultureName, targetCultureName);
                    }
                    catch (Exception exception)
                    {
                        DiagnosticsTool.MyTrace(exception);
                    }
                }
            }

            foreach (System.Windows.Controls.CheckBox checkBox in dependencyObject.FindVisualChildren <System.Windows.Controls.CheckBox>())
            {
                if (checkBox.Content is string)
                {
                    if (!this.dependencyObjects.ContainsKey(checkBox))
                    {
                        this.dependencyObjects.Add(checkBox, (string)checkBox.Content);
                    }


                    //Text 속석을 사용 할 수 없는 컨트롤도 있음
                    try
                    {
                        checkBox.Content = ((ITranslator)this).Translate(this.dependencyObjects[checkBox], sourceCultureName, targetCultureName);
                    }
                    catch (Exception exception)
                    {
                        DiagnosticsTool.MyTrace(exception);
                    }
                }
            }

            foreach (System.Windows.Controls.Button button in dependencyObject.FindVisualChildren <System.Windows.Controls.Button>())
            {
                if (button.Content is string)
                {
                    if (!this.dependencyObjects.ContainsKey(button))
                    {
                        this.dependencyObjects.Add(button, (string)button.Content);
                    }


                    //Text 속석을 사용 할 수 없는 컨트롤도 있음
                    try
                    {
                        button.Content = ((ITranslator)this).Translate(this.dependencyObjects[button], sourceCultureName, targetCultureName);
                    }
                    catch (Exception exception)
                    {
                        DiagnosticsTool.MyTrace(exception);
                    }
                }
            }
        }
        public async void SetTopMenu(DataTable dataTable)
        {
            ComboxItem        comboxItem1;
            ComboxItem        comboxItem2;
            int               cntException;
            List <ComboxItem> comboxItems;
            decimal           defaultMenuID;

            comboxItems = new List <ComboxItem>();

            cntException = 0;
            comboxItem2  = null;

            try
            {
                defaultMenuID = this.Core.GetAttributeDecimal("DefaultMenuID");
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
                defaultMenuID = -1;
            }

            foreach (DataRow dataRow in dataTable.Rows)
            {
                try
                {
                    comboxItem1 = new ComboxItem()
                    {
                        MenuID       = (decimal)dataRow["MENU_ID"],
                        ParentMenuID = (decimal)dataRow["PARENT_MENU_ID"],
                        Name         = (string)dataRow["NAME"],
                        Description  = (string)dataRow["DESCRIPTION"],
                        Image        = dataRow["IMAGE_URL1"] != DBNull.Value && (string)dataRow["IMAGE_URL1"] != ""
                                                    ? (((string)dataRow["IMAGE_URL1"]).Contains("http")
                                                        ? await this.Core.GetAttributeMediaWebImage(new Uri((string)dataRow["IMAGE_URL1"]))
                                                        : null)
                                                    : null
                    };

                    if (comboxItem1 != null)
                    {
                        comboxItems.Add(comboxItem1);

                        if (defaultMenuID == comboxItem1.MenuID)
                        {
                            comboxItem2 = comboxItem1;
                        }

                        if (dataTable.Rows.Count == (comboxItems.Count + cntException))
                        {
                            this.ComboxMenuItem = comboxItems;

                            if (comboxItem2 != null)
                            {
                                this.ComboxMenuItemSelected = comboxItem2;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    cntException += 1;
                }
            }


            //comboxItem1 = new ComboxItem()
            //{
            //    Text = "생산관리",
            //    Image = new BitmapImage(new Uri("/Atomus.Windows.Controls.Toolbar.ModernToolbar;component/Image/icon-menu-02-pm.png", UriKind.Relative))
            //};

            //if (comboxItem1 != null && comboxItem1.Image != null)
            //    this.ComboxMenuItem.Add(comboxItem1);

            //comboxItem1 = new ComboxItem()
            //{
            //    Text = "히스토리안",
            //    Image = new BitmapImage(new Uri("/Atomus.Windows.Controls.Toolbar.ModernToolbar;component/Image/icon-menu-03-history.png", UriKind.Relative))
            //};

            //if (comboxItem1 != null && comboxItem1.Image != null)
            //    this.ComboxMenuItem.Add(comboxItem1);

            //comboxItem1 = new ComboxItem()
            //{
            //    Text = "방사제조",
            //    Image = await this.Core.GetAttributeMediaWebImage("Image1")
            //};

            //if (comboxItem1 != null)
            //    this.ComboxMenuItem.Add(comboxItem1);

            //comboxItem1 = new ComboxItem()
            //{
            //    Text = "물성추적",
            //    Image = new BitmapImage(new Uri("/Atomus.Windows.Controls.Toolbar.ModernToolbar;component/Image/icon-menu-05.png", UriKind.Relative))
            //};

            //if (comboxItem1 != null && comboxItem1.Image != null)
            //    this.ComboxMenuItem.Add(comboxItem1);
        }
        /// <summary>
        /// 기본 메뉴 이미지 설정
        /// </summary>
        /// <param name="menuItem"></param>
        private void SetDefaultImage(MenuItem menuItem)
        {
            if (menuItem == null)
            {
                return;
            }

            string strKeyName = "";

            if (menuItem.Name.Contains("개발"))
            {
                strKeyName = "Image_Menu_Development_N";
            }
            else if (menuItem.Name.Contains("메뉴 리스트"))
            {
                strKeyName = "Image_Menu_MenuList_N";
            }
            else if (menuItem.Name.Contains("메뉴,툴바 권한"))
            {
                strKeyName = "Image_Menu_MenuResponsibility_N";
            }
            else if (menuItem.Name.Contains("권한"))
            {
                strKeyName = "Image_Menu_Responsibility_N";
            }
            else if (menuItem.Name.Contains("계정"))
            {
                strKeyName = "Image_Menu_Account_N";
            }
            else if (menuItem.Name.Contains("지역화"))
            {
                strKeyName = "Image_Menu_Localization_N";
            }
            else if (menuItem.Name.Contains("팩토리"))
            {
                strKeyName = "Image_Menu_Factory_N";
            }
            else if (menuItem.Name.Contains("트렌드"))
            {
                strKeyName = "Image_Menu_TrendAndData_N";
            }
            else if (menuItem.Name.Contains("기술통계"))
            {
                strKeyName = "Image_Menu_Statistics_N";
            }
            else if (menuItem.Name.Contains("구매"))
            {
                strKeyName = "Image_Menu_AMX_N";
            }
            else if (menuItem.Name.Contains("출하"))
            {
                strKeyName = "Image_Menu_AMT_N";
            }
            else if (menuItem.Name.Contains("품질"))
            {
                strKeyName = "Image_Menu_AMU_N";
            }
            else if (menuItem.Name.Contains("생산"))
            {
                strKeyName = "Image_Menu_Production_N";
            }

            try
            {
                if (!strKeyName.IsNullOrWhiteSpace())
                {
                    System.Windows.Media.Imaging.BitmapImage bitimg =
                        (System.Windows.Media.Imaging.BitmapImage)Application.Current.FindResource(strKeyName);
                    Image image = new Image()
                    {
                        Source = bitimg
                    };
                    menuItem.DefImage = image.Source;
                }
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
            }
        }
        private async Task <ObservableCollection <TreeViewItem> > SetTree1(DataTable dataTable)
        {
            ObservableCollection <TreeViewItem> trees;
            TreeViewItem treeViewItem;
            MenuItem     menuItem;
            StackPanel   stackPanel;
            Image        image;
            ImageSource  imageSourceFolder;
            ImageSource  imageSourceAssemblies;
            Label        label;
            bool         showNamespace;
            bool         showAssemblyID;
            bool         isAdd;
            string       rootImagesUrlPath;

            imageSourceFolder     = null;
            imageSourceAssemblies = null;
            showNamespace         = false;
            showAssemblyID        = false;
            trees = new ObservableCollection <TreeViewItem>();

            try
            {
                imageSourceFolder     = new ImageBrush(await this.Core.GetAttributeMediaWebImage("FolderImage")).ImageSource;
                imageSourceAssemblies = new ImageBrush(await this.Core.GetAttributeMediaWebImage("AssembliesImage")).ImageSource;
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
            }

            try
            {
                showNamespace  = this.Core.GetAttribute("ShowNamespace.RESPONSIBILITY_ID").Split(',').Contains(Config.Client.GetAttribute("Account.RESPONSIBILITY_ID").ToString());
                showAssemblyID = this.Core.GetAttribute("ShowAssemblyID.RESPONSIBILITY_ID").Split(',').Contains(Config.Client.GetAttribute("Account.RESPONSIBILITY_ID").ToString());
            }
            catch (Exception ex)
            {
                DiagnosticsTool.MyTrace(ex);
            }

            rootImagesUrlPath = Factory.FactoryConfig.GetAttribute("Atomus", "RootImagesUrlPath");

            foreach (DataRow dataRow in dataTable.Rows)
            {
                menuItem = new MenuItem()
                {
                    MenuID       = (decimal)dataRow["MENU_ID"],
                    ParentMenuID = (decimal)dataRow["PARENT_MENU_ID"],
                    Name         = (string)dataRow["NAME"],
                    Decription   = (string)dataRow["DESCRIPTION"],

                    Image1 = dataRow["IMAGE_URL1"] != DBNull.Value && (string)dataRow["IMAGE_URL1"] != "" ?
                             (((string)dataRow["IMAGE_URL1"]).Contains("http") ?
                              new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri((string)dataRow["IMAGE_URL1"]))).ImageSource
                            : new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri(string.Format("{0}{1}", (string)dataRow["IMAGE_URL1"], rootImagesUrlPath)))).ImageSource)
                        : null,

                    Image2 = dataRow["IMAGE_URL2"] != DBNull.Value && (string)dataRow["IMAGE_URL2"] != "" ?
                             (((string)dataRow["IMAGE_URL2"]).Contains("http") ?
                              new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri((string)dataRow["IMAGE_URL2"]))).ImageSource
                            : new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri(string.Format("{0}{1}", (string)dataRow["IMAGE_URL2"], rootImagesUrlPath)))).ImageSource)
                        : null,

                    Image3 = dataRow["IMAGE_URL3"] != DBNull.Value && (string)dataRow["IMAGE_URL3"] != "" ?
                             (((string)dataRow["IMAGE_URL3"]).Contains("http") ?
                              new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri((string)dataRow["IMAGE_URL3"]))).ImageSource
                            : new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri(string.Format("{0}{1}", (string)dataRow["IMAGE_URL3"], rootImagesUrlPath)))).ImageSource)
                        : null,

                    Image4 = dataRow["IMAGE_URL4"] != DBNull.Value && (string)dataRow["IMAGE_URL4"] != "" ?
                             (((string)dataRow["IMAGE_URL4"]).Contains("http") ?
                              new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri((string)dataRow["IMAGE_URL4"]))).ImageSource
                            : new ImageBrush(await this.Core.GetAttributeMediaWebImage(new Uri(string.Format("{0}{1}", (string)dataRow["IMAGE_URL4"], rootImagesUrlPath)))).ImageSource)
                        : null,

                    AssemblyID = dataRow["ASSEMBLY_ID"] == DBNull.Value ? -1 : (decimal)dataRow["ASSEMBLY_ID"],
                    Namespace  = dataRow["NAMESPACE"].ToString(),
                    VisibleOne = dataRow["VISIBLE_ONE"] != DBNull.Value && (string)dataRow["VISIBLE_ONE"] != "N"
                };

                stackPanel = new StackPanel()
                {
                    Orientation = Orientation.Horizontal
                };

                if (menuItem.Image1 != null)
                {
                    image = new Image()
                    {
                        Source = menuItem.Image1
                    }
                }
                ;
                else
                {
                    if (menuItem.AssemblyID > 0)
                    {
                        image = new Image()
                        {
                            Source = imageSourceAssemblies
                        }
                    }
                    ;
                    else
                    {
                        image = new Image()
                        {
                            Source = imageSourceFolder
                        }
                    };
                }
                stackPanel.Children.Add(image);

                label = new Label()
                {
                    Content = showAssemblyID ? string.Format("{0} ({1}.{2})", menuItem.Name.Translate(), menuItem.MenuID, menuItem.AssemblyID) : menuItem.Name.Translate()
                };
                label.ToolTip           = showNamespace ? string.Format("{0} {1}", menuItem.Decription.Translate(), menuItem.Namespace) : menuItem.Decription.Translate();
                label.VerticalAlignment = VerticalAlignment.Center;
                label.Tag        = menuItem;
                label.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                stackPanel.Children.Add(label);


                treeViewItem = new TreeViewItem()
                {
                    Header = stackPanel, Tag = menuItem
                };

                if (menuItem.AssemblyID > 0)
                {
                    label.MouseDoubleClick += Label_MouseDoubleClick;
                }

                if (trees.Count > 0)
                {
                    isAdd = false;

                    foreach (TreeViewItem treeViewItemTmp in trees)
                    {
                        if ((treeViewItemTmp.Tag as MenuItem).MenuID == menuItem.ParentMenuID)
                        {
                            treeViewItemTmp.Items.Add(treeViewItem);
                            isAdd = true;
                        }
                        else
                        {
                            var a = treeViewItemTmp.Items.OfType <TreeViewItem>().ToList().Where(x => (x.Tag as MenuItem).MenuID == menuItem.ParentMenuID);

                            if (a.Count() == 1)
                            {
                                a.First().Items.Add(treeViewItem);
                                isAdd = true;
                            }
                        }
                    }

                    if (!isAdd)
                    {
                        trees.Add(treeViewItem);
                    }
                }
                else
                {
                    trees.Add(treeViewItem);
                }
            }

            return(trees);
        }
        string ITranslator.Translate(string source, string sourceCultureName, string targetCultureName, params string[] args)
        {
            DataSet   dataSet;
            DataTable dataTable;

            try
            {
                if (!((ITranslator)this).Dictionary.ContainsKey(sourceCultureName))
                {
                    this.LoadDictionary(sourceCultureName, targetCultureName);
                }

                if (((ITranslator)this).Dictionary.ContainsKey(sourceCultureName))
                {
                    dataSet = ((ITranslator)this).Dictionary[sourceCultureName];

                    if (!dataSet.Tables.Contains(targetCultureName))
                    {
                        this.LoadDictionary(sourceCultureName, targetCultureName);
                    }

                    dataTable = dataSet.Tables[targetCultureName];

                    if (dataTable == null || dataTable.Rows.Count < 1)
                    {
                        this.UnicodeCategoryCheckAndSave(source, sourceCultureName);
                    }
                    else
                    {
                        foreach (DataRow _DataRow in dataTable.Rows)
                        {
                            if (((string)_DataRow[0]).Equals(source))
                            {
                                if (args == null || args.Length == 0)
                                {
                                    return((string)_DataRow[1]);
                                }
                                else
                                {
                                    return(string.Format((string)_DataRow[1], ((ITranslator)this).Translate(args)));
                                }
                            }
                            else
                            {
                                this.UnicodeCategoryCheckAndSave(source, sourceCultureName);
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                DiagnosticsTool.MyTrace(exception);
            }
            finally
            { }

            if (args == null || args.Length == 0)
            {
                return(source);
            }
            else
            {
                return(string.Format(source, ((ITranslator)this).Translate(args)));
            }
        }
        void ITranslator.Restoration(DependencyObject dependencyObject)
        {
            foreach (System.Windows.Controls.Label label in dependencyObject.FindVisualChildren <System.Windows.Controls.Label>())
            {
                if (label.Content is string)
                {
                    if (this.dependencyObjects.ContainsKey(label))
                    {
                        //Text 속석을 사용 할 수 없는 컨트롤도 있음
                        try
                        {
                            label.Content = this.dependencyObjects[label];
                        }
                        catch (Exception exception)
                        {
                            DiagnosticsTool.MyTrace(exception);
                        }

                        this.dependencyObjects.Remove(label);
                    }
                }
            }

            foreach (System.Windows.Controls.CheckBox checkBox in dependencyObject.FindVisualChildren <System.Windows.Controls.CheckBox>())
            {
                if (checkBox.Content is string)
                {
                    if (this.dependencyObjects.ContainsKey(checkBox))
                    {
                        //Text 속석을 사용 할 수 없는 컨트롤도 있음
                        try
                        {
                            checkBox.Content = this.dependencyObjects[checkBox];
                        }
                        catch (Exception exception)
                        {
                            DiagnosticsTool.MyTrace(exception);
                        }

                        this.dependencyObjects.Remove(checkBox);
                    }
                }
            }

            foreach (System.Windows.Controls.Button button in dependencyObject.FindVisualChildren <System.Windows.Controls.Button>())
            {
                if (button.Content is string)
                {
                    if (this.dependencyObjects.ContainsKey(button))
                    {
                        //Text 속석을 사용 할 수 없는 컨트롤도 있음
                        try
                        {
                            button.Content = this.dependencyObjects[button];
                        }
                        catch (Exception exception)
                        {
                            DiagnosticsTool.MyTrace(exception);
                        }

                        this.dependencyObjects.Remove(button);
                    }
                }
            }
        }