Beispiel #1
0
        private void newBrandLauncherView(Interop.SystemTime time, Brand brand)
        {
            BrandLauncherView view = new BrandLauncherView(this.time)
            {
                Top           = Application.Current.MainWindow.Top,
                Left          = Application.Current.MainWindow.Left + base.Width,
                Height        = Application.Current.MainWindow.Height,
                DataContext   = brand,
                Title         = brand.NameAndFolder,
                ShowActivated = false,
                Owner         = this
            };

            _dictBrandLauncherView.Add(brand.BrandId, view);
            view.EventNewBrowserLauncherView += new Action <Interop.SystemTime, BrandProvider>(showBrowserLauncherView);
            view.Closing += new CancelEventHandler(closingViewer <BrandLauncherView>);

            this.currentBrandLauncher = view;
            this.currentBrandLauncher.Show();
        }
Beispiel #2
0
        private void newBrowserLauncherView(Interop.SystemTime time, BrandProvider brandProvider)
        {
            Uri    uri;
            string urlSession = string.Empty;

            uri        = new Uri(brandProvider.Uri);
            urlSession = string.Format("{0}://{1}", uri.Scheme, uri.Host);

            if (_dictBrowserLauncherView.ContainsKey(brandProvider.ProviderId) == false)
            {
                _dictBrowserLauncherView.Add(brandProvider.ProviderId, new BrowserLauncherView(time
                                                                                               , brandProvider.Title
                                                                                               , brandProvider.Uri
                                                                                               , brandProvider.ProviderId
                                                                                               , brandProvider.Login
                                                                                               , brandProvider.Password));
                _dictBrowserLauncherView[brandProvider.ProviderId].Closing += new CancelEventHandler(closingViewer <BrowserLauncherView>);
                _dictBrowserLauncherView[brandProvider.ProviderId].Show();
            }
            else
            {
                _dictBrowserLauncherView[brandProvider.ProviderId].Activate();
            }
        }
Beispiel #3
0
        private void showBrowserLauncherView(Interop.SystemTime time, BrandProvider brandProvider)
        {
            Uri    uri;
            string urlSession = string.Empty;
            KeyBrowserLauncherView keyView;
            IOrderedEnumerable <KeyBrowserLauncherView> keys;
            MessageBoxResult res;
            int iMaxCountLauncherOnProvider = 1;

            uri        = new Uri(brandProvider.Uri);
            urlSession = string.Format("{0}://{1}", uri.Scheme, uri.Host);

            int.TryParse(ConfigurationManager.AppSettings["MaxCountLauncherOnProvider"], out iMaxCountLauncherOnProvider);
            keys = _dictBrowserLauncherView.Keys.Where(key => { return(key.ProviderId == brandProvider.ProviderId); })
                   .OrderBy(key => key.StampDateTime);

            if ((keys.Count() == 0) ||
                (keys.Count() < iMaxCountLauncherOnProvider))
            {
                if (keys.Count() > 0)
                {
                    res = MessageBox.Show(string.Format("Каталог этого провайдера уже отображается ({1} шт.).{0}Открыть новый каталог ({2})?{0}Установить фокус ввода на открытый ранее({3})?{0}Отменить операцию({4})?"
                                                        , Environment.NewLine
                                                        , keys.Count()
                                                        , MessageBoxResult.Yes, MessageBoxResult.No, MessageBoxResult.Cancel)
                                          , "Внимание!"
                                          , MessageBoxButton.YesNoCancel);
                }
                else
                {
                    res = MessageBoxResult.Yes;
                }

                if (res == MessageBoxResult.Yes)
                {
                    keyView = new KeyBrowserLauncherView()
                    {
                        ProviderId      = brandProvider.ProviderId
                        , StampDateTime =
                            //new DateTime(
                            //    time.Year, time.Month, time.Day
                            //    , time.Hour, time.Minute, time.Second, time.Millisecond
                            //    , DateTimeKind.Local
                            //)
                            DateTime.Now
                    };

                    _dictBrowserLauncherView.Add(keyView
                                                 , new BrowserLauncherView(time
                                                                           , brandProvider.Title
                                                                           , brandProvider.Uri
                                                                           , brandProvider.ProviderId
                                                                           , brandProvider.Login
                                                                           , brandProvider.Password));
                    _dictBrowserLauncherView[keyView].Closing += new CancelEventHandler(closingViewer <BrowserLauncherView>);
                    _dictBrowserLauncherView[keyView].Show();
                }
                else if (res == MessageBoxResult.No)
                {
                    keyView = keys.ElementAt(0);
                    _dictBrowserLauncherView[keyView].Activate();
                }
                else
                {
                    ;
                }
            }
            else
            {
                keyView = keys.ElementAt(0);
                _dictBrowserLauncherView[keyView].Activate();
            }
        }