Esempio n. 1
0
        private async void ButtonAddB_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFileDialog
            {
                Multiselect     = false,
                CheckFileExists = true,
                CheckPathExists = true,
                Filter          = "Dat files (*.dat)|*.dat"
            };

            var dr = dialog.ShowDialog();

            if (dr.HasValue && dr.Value && (SwapManager.EntityB == null ||
                                            string.CompareOrdinal(SwapManager.EntityB.DatFilePath, dialog.FileName) != 0))
            {
                SwapManager.EntityB?.CloseController();
                SwapManager.SetReserveEntity(dialog.FileName);

                try
                {
                    await SwapManager.EntityB.InitAsync();
                }
                finally
                {
                    HideB(false);
                    ButtonAddB.Visibility    = Visibility.Collapsed;
                    ButtonRemoveB.Visibility = Visibility.Visible;

                    RenewViewB();

                    TextBlockPathAlt.GetBindingExpression(TextBlock.TextProperty)?.UpdateTarget();
                }
            }
        }
Esempio n. 2
0
        private void ButtonRemoveB_OnClick(object sender, RoutedEventArgs e)
        {
            SwapManager.RemoveReserveEntity();
            SubscriptionB = null;

            UpdateTargetB();
            TextBlockPathAlt.GetBindingExpression(TextBlock.TextProperty)?.UpdateTarget();

            HideB();
            ButtonAddB.Visibility    = Visibility.Visible;
            ButtonRemoveB.Visibility = Visibility.Collapsed;

            Settings.Default.ReserveDat = string.Empty;
            Settings.Default.Save();
        }