public AppSettingsView(IActivityContext <Unit> context)
        {
            this.context      = context;
            LocalesCollection = new ObservableCollection <odm.localization.Language>();

            this.CommandBindings.Add(
                new CommandBinding(
                    AppSettingsView.ApplyCommand,
                    (s, a) => {
                odm.localization.Language.Current = (localization.Language)langValue.SelectedItem;
                odm.ui.Properties.Settings.Default.DefaultLocaleIso3 = odm.localization.Language.Current.iso3;
                odm.ui.Properties.Settings.Default.Save();

                var vs = AppDefaults.visualSettings;

                vs.Events_IsEnabled            = enableEventValue.IsChecked.Value;
                vs.EventsCollect_IsEnabled     = collectEventsValue.IsChecked.Value;
                vs.Snapshot_IsEnabled          = enableSnapshotValue.IsChecked.Value;
                vs.CustomAnalytics_IsEnabled   = enableCustomAnalyticsValuse.IsChecked.Value;
                vs.ui_video_rendering_fps      = videoRenderingFpsValue.Value ?? 30;
                vs.Event_Subscription_Type     = ((KeyValuePair <VisualSettings.EventType, string>)eventType.SelectedValue).Key;
                vs.Base_Subscription_Port      = basePortValue.Value.Value;
                vs.ShowVideoPlaybackStatistics = showVideoPlaybackStatisticsValue.IsChecked == true;
                vs.Transport_Type           = ((KeyValuePair <TransportProtocol, string>)transportTypes.SelectedValue).Key;
                vs.OpenInExternalWebBrowser = webValue.IsChecked.Value;
                vs.EnableGraphicAnnotation  = enableGraphicAnnotationValue.IsChecked.Value;

                vs.UseOnlyCommonFilterView = enableOnlyDefValue.IsChecked.Value;

                AppDefaults.UpdateVisualSettings(vs);


                Success();
            }
                    )
                );

            this.CommandBindings.Add(
                new CommandBinding(
                    AppSettingsView.CancelCommand,
                    (s, a) => {
                Success();
            }
                    )
                );

            InitializeComponent();

            BindData();
            LocaLization();
        }
        public MainWindow()
        {
            InitializeComponent();

            devlistCaption.CreateBinding(TextBlock.TextProperty, LocalTitles.instance, s => s.devicesList);

            this.CommandBindings.Add(
                new CommandBinding(
                    DeviceListView.HideCommand,
                    (s, a) => {
                devlist.Visibility          = Visibility.Collapsed;
                deviceListButton.Visibility = Visibility.Visible;
            }
                    )
                );
            deviceListButton.Command = new DelegateCommand(
                () => {
                devlist.Visibility          = Visibility.Visible;
                deviceListButton.Visibility = Visibility.Collapsed;
            }
                );


            //AppDefaults.InitConfigs();

            InitPosition();

            SizeChanged += new SizeChangedEventHandler((obj, evargs) => {
                var mvs      = AppDefaults.visualSettings;
                mvs.WndState = this.WindowState;

                if (this.WindowState == System.Windows.WindowState.Maximized)
                {
                    AppDefaults.UpdateVisualSettings(mvs);
                    return;
                }

                if (this.WindowState == System.Windows.WindowState.Minimized)
                {
                    AppDefaults.UpdateVisualSettings(mvs);
                    return;
                }

                mvs.WndSize = new Rect(mvs.WndSize.X, mvs.WndSize.Y, evargs.NewSize.Width, evargs.NewSize.Height);
                AppDefaults.UpdateVisualSettings(mvs);
            });
            LocationChanged += new EventHandler((obj, evargs) => {
                var vs      = AppDefaults.visualSettings;
                vs.WndState = this.WindowState;
                if (this.WindowState == System.Windows.WindowState.Maximized)
                {
                    AppDefaults.UpdateVisualSettings(vs);
                    return;
                }
                if (this.WindowState == System.Windows.WindowState.Minimized)
                {
                    AppDefaults.UpdateVisualSettings(vs);
                    return;
                }

                vs.WndSize = new Rect(this.Left, this.Top, vs.WndSize.Width, vs.WndSize.Height);
                AppDefaults.UpdateVisualSettings(vs);
            });
        }