コード例 #1
0
ファイル: WindowManager.cs プロジェクト: Slesa/Playground
        /// <summary>
        ///   Shows a modal dialog for the specified model.
        /// </summary>
        /// <param name = "rootModel">The root model.</param>
        /// <param name = "context">The context.</param>
        public virtual void ShowDialog(object rootModel, object context = null) {
            var navigationSvc = IoC.Get<INavigationService>();
            var page = navigationSvc.CurrentContent as PhoneApplicationPage;
            if(page == null)
                throw new InvalidOperationException(
                    string.Format("In order to use ShowDialog the view currently loaded in the application frame ({0})"
                                  + " should inherit from PhoneApplicationPage or one of its descendents.", navigationSvc.CurrentContent.GetType()));

            var host = new DialogHost(page);
            var view = ViewLocator.LocateForModel(rootModel, host, context);
            host.Content = view;
            host.SetValue(View.IsGeneratedProperty, true);

            ViewModelBinder.Bind(rootModel, host, null);
            host.SetActionTarget(rootModel);

            var activatable = rootModel as IActivate;
            if(activatable != null)
                activatable.Activate();

            var deactivator = rootModel as IDeactivate;
            if(deactivator != null)
                host.Closed += delegate { deactivator.Deactivate(true); };

            host.Open();
        }
コード例 #2
0
ファイル: WindowManager.cs プロジェクト: karbazol/FBReaderCS
        /// <summary>
        ///   Shows a modal dialog for the specified model.
        /// </summary>
        /// <param name = "rootModel">The root model.</param>
        /// <param name = "context">The context.</param>
        /// <param name = "settings">The optional dialog settings.</param>
        public virtual void ShowDialog(object rootModel, object context = null, IDictionary<string, object> settings = null) {
            var navigationSvc = IoC.Get<INavigationService>();

            var host = new DialogHost(navigationSvc);
            var view = ViewLocator.LocateForModel(rootModel, host, context);
            host.Content = view;
            host.SetValue(View.IsGeneratedProperty, true);

            ViewModelBinder.Bind(rootModel, host, null);
            host.SetActionTarget(rootModel);

            ApplySettings(host, settings);

            var activatable = rootModel as IActivate;
            if (activatable != null) {
                activatable.Activate();
            }

            var deactivator = rootModel as IDeactivate;
            if (deactivator != null) {
                host.Closed += delegate { deactivator.Deactivate(true); };
            }

            host.Open();
        }
コード例 #3
0
        private void LoadDialogAccountEdit()
        {
            EditAccountViewModel account = new EditAccountViewModel();

            DialogHost.Show(account, "RootDialog");
        }
コード例 #4
0
 public DialogHostTests()
 {
     _dialogHost = new DialogHost();
     _dialogHost.RaiseEvent(new RoutedEventArgs(FrameworkElement.LoadedEvent));
 }
コード例 #5
0
        public static async Task ShowExtractOperationDialog(string extractLocation, IEnumerable <WadFileViewModel> entries)
        {
            ExtractOperationDialog dialog = new ExtractOperationDialog(extractLocation, entries);

            await DialogHost.Show(dialog, "OperationDialog", dialog.StartExtraction, null);
        }
コード例 #6
0
        public void Voir(GestionnaireEcrans gestionnaireEcrans)
        {
            bool erreur = true;

            Grid conteneurPage = new Grid {
                Width = 1000, Height = 600
            };

            conteneurPage.ColumnDefinitions.Add(new ColumnDefinition());
            conteneurPage.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(64)
            });
            conteneurPage.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(32)
            });
            conteneurPage.RowDefinitions.Add(new RowDefinition());

            conteneurPage.Children.Add(new DialogHost {
                Identifier = "dialogLocal"
            });

            Button btnFermer = new Button
            {
                Content    = 'X',
                Foreground = Brushes.Black,
                Background = Brushes.White,
                Command    = DialogHost.CloseDialogCommand
            };

            Grid.SetColumn(btnFermer, 1);

            conteneurPage.Children.Add(btnFermer);

            Grid contextePage = new Grid {
                Margin = new Thickness(16)
            };

            Grid.SetColumnSpan(contextePage, 2);
            Grid.SetRow(contextePage, 1);

            conteneurPage.Children.Add(contextePage);

            GestionnaireEcrans gestionnaireEcransDialog = new GestionnaireEcrans(contextePage);

            if (LienNotificationEcran.TypeEcran == typeof(ViewProfessionnelDossierPatient))
            {
                erreur = false;
                Citoyen citoyen = DataModelCitoyen.GetUnCitoyen(
                    new Citoyen {
                    AssMaladie = LienNotificationEcran.Parametres["AssuranceMaladiePatient"] as string
                }
                    );
                gestionnaireEcransDialog.Changer(new ViewPatientHospitalisation(
                                                     gestionnaireEcransDialog,
                                                     citoyen,
                                                     DataModelHospitalisation.GetHospitalisation(citoyen)
                                                     ));
            }
            else if (LienNotificationEcran.TypeEcran == typeof(ViewMessageNotification))
            {
                erreur = false;
                gestionnaireEcransDialog.Changer(
                    new ViewMessageNotification(
                        int.Parse(LienNotificationEcran.Parametres["Sender"] as string),
                        LienNotificationEcran.Parametres["Titre"] as string,
                        LienNotificationEcran.Parametres["Message"] as string
                        )
                    );
            }

            if (!erreur)
            {
                if (LienNotificationEcran.TypeEcran == typeof(ViewProfessionnelDossierPatient))
                {
                    gestionnaireEcrans.AfficherMessage(
                        "Note: voici le bon écran, mais puisque Laurence ne crée pas de notification lors de la création d'une note, je ne peut pas afficher la bonne note, puisqu'elle n'existe pas!",
                        "Voir",
                        "dialogGeneral",
                        () => DialogHost.Show(conteneurPage, "dialogGeneral")
                        );
                }
                else
                {
                    DialogHost.Show(conteneurPage, "dialogGeneral");
                }
            }
            else
            {
                gestionnaireEcrans.AfficherMessage("Une erreur est survenue lors de l'ouverture de la notification");
            }
        }
コード例 #7
0
 private async void ExecuteShowPlaylistSearchCommand()
 {
     var result = await DialogHost.Show(_container.Resolve <IYoutubeFindUploader>(), "RootDialog");
 }
コード例 #8
0
ファイル: Bookmark.xaml.cs プロジェクト: Terkiss/Koromo-Copy
        private async void Tvi_DropAsync(object sender, DragEventArgs e)
        {
            // Drop 이벤트에선 Bubbling이 일어나기 때문에 e.Handled를 true로 조작하거나
            // lock을 사용하여 처리해줄 필요가 있음
            // 단, lock을 사용할경우 unlock처리 지연을 위한 루틴이 하나이상 있어야함
            ClassifyTree.AllowDrop = false;
            var iscopy = (e.AllowedEffects & DragDropEffects.Copy) != 0 && Keyboard.IsKeyDown(Key.LeftCtrl);

            if (e.Data.GetDataPresent("registries"))
            {
                var tt = e.Data.GetData("registries") as Tuple <string, List <BookmarkPageDataGridItemViewModel> >;

                lock (drop_lock)
                    if (drop_checker == true)
                    {
                        var tvi = sender as TreeViewItem;
                        tvi.Foreground = Brushes.Black;
                        return;
                    }
                lock (drop_lock)
                    drop_checker = true;

                var message = $"{tt.Item2.Count}개 항목을 {tt.Item1}에서 {(sender as TreeViewItem).Tag}로 {(iscopy ? "복사할" : "옮길")}까요?";
                var dialog  = new BookmarkMessage(message);
                if ((bool)(await DialogHost.Show(dialog, "BookmarkDialog")))
                {
                    if (iscopy == false)
                    {
                        // 기존항목들 삭제
                        foreach (var ll in tt.Item2)
                        {
                            List <Tuple <string, BookmarkItemModel> > rl;
                            if (ll.형 == "작가")
                            {
                                rl = BookmarkModelManager.Instance.Model.artists;
                            }
                            else if (ll.형 == "그룹")
                            {
                                rl = BookmarkModelManager.Instance.Model.groups;
                            }
                            else
                            {
                                rl = BookmarkModelManager.Instance.Model.articles;
                            }

                            for (int i = 0; i < rl.Count; i++)
                            {
                                if (rl[i].Item1 == tt.Item1 && rl[i].Item2.Equals(ll.BIM))
                                {
                                    rl.RemoveAt(i);
                                    break;
                                }
                            }
                        }
                    }

                    // 추가
                    foreach (var ll in tt.Item2)
                    {
                        List <Tuple <string, BookmarkItemModel> > rl;
                        if (ll.형 == "작가")
                        {
                            rl = BookmarkModelManager.Instance.Model.artists;
                        }
                        else if (ll.형 == "그룹")
                        {
                            rl = BookmarkModelManager.Instance.Model.groups;
                        }
                        else
                        {
                            rl = BookmarkModelManager.Instance.Model.articles;
                        }

                        rl.Add(new Tuple <string, BookmarkItemModel>((sender as TreeViewItem).Tag.ToString(), ll.BIM));
                    }

                    BookmarkModelManager.Instance.Save();
                    refresh();
                }
            }
            else if (e.Data.GetDataPresent("classify"))
            {
                var from = e.Data.GetData("classify") as string;
                var to   = (sender as TreeViewItem).Tag as string;

                lock (drop_lock)
                    if (drop_checker == true)
                    {
                        var tvi = sender as TreeViewItem;
                        tvi.Foreground = Brushes.Black;
                        return;
                    }
                lock (drop_lock)
                    drop_checker = true;

                if (from == to || (to.StartsWith(from) && !iscopy))
                {
                    var dialog = new BookmarkMessageOk($"같은 분류 또는 하위 분류로는 {(iscopy ? "복사할" : "옮길")} 수 없어요!");
                    await DialogHost.Show(dialog, "BookmarkDialog");

                    goto END;
                }

                await classify_move(from, to, iscopy);
            }
END:
            lock (drop_lock)
                drop_checker = false;
            var tvi2 = sender as TreeViewItem;

            tvi2.Foreground = Brushes.Black;
        }
コード例 #9
0
 private async void EditInvoiceCategories(object obj)
 {
     Wizards.EditInvoiceCategories eic;
     eic = new Wizards.EditInvoiceCategories();
     var result = await DialogHost.Show(eic, "RootDialog", ExtendedOpenedEventHandler, ExtendedClosingInvoiceCategoriesEventHandler);
 }
コード例 #10
0
ファイル: WindowViewModel.cs プロジェクト: forki/Labs
        private async void ExecSetRelationsDialog(object o)
        {
            ApplicationErrors = string.Empty;
            _removedRelationships.Clear();
            _newRelationships.Clear();

            var view = new RelationsGridDialog
            {
                DataContext = this
            };

            var result = await DialogHost.Show(view, "RootDialog", ClosingEventHandler);

            if ((bool)result)
            {
                if (_newRelationships.Any() || _removedRelationships.Any())
                {
                    try
                    {
                        var config = XmlHelper <CConfiguration> .Load(DefaultConfigFile);

                        var ds = config.Dataset.FirstOrDefault(d => d.name.Equals(SelectedDataset.name));
                        foreach (var rel in _removedRelationships)
                        {
                            ds.Relationship.Remove(ds.Relationship.FirstOrDefault(r => r.name.Equals(rel.name)));
                        }
                        if (_newRelationships.Any())
                        {
                            ds.Relationship.AddRange(_newRelationships);
                        }

                        XmlHelper <CConfiguration> .Save(DefaultConfigFile, config);
                    }
                    catch (Exception e)
                    {
                        Logger.Log.Error(e, "Exception while saving relationships to file {0}", DefaultConfigFile);
                        MessageQueue.Enqueue(e.Message);
                    }
                }

                if (_newRelationships.Any())
                {
                    IsBusy = true;

                    if (_viewMode == eViewMode.Data &&
                        SelectedTable != null && SelectedTable.DataTable != null && SelectedTable.DataTable.Rows.Count > 0)
                    {
                        _schedulerProvider.Background.Schedule(() =>
                        {
                            try
                            {
                                _newRelationships.ToList().ForEach(async(r) =>
                                {
                                    var child = SelectedTable.Children.FirstOrDefault(t => t.name.Equals(r.toTable));
                                    if (child != null)
                                    {
                                        child.DataTable =
                                            await _dataSourceProvider
                                            .GetData(SelectedDatasource, child.name,
                                                     _dataSourceProvider.QueryBuilder.GetQuery(child, Settings.RowsPerPage, parent: SelectedTable));
                                    }
                                });

                                _newRelationships.Clear();
                            }
                            catch (Exception e)
                            {
                                Logger.Log.Error(e, "Exception while loading new relationship for table {@name}"
                                                 , SelectedTable.name);
                                MessageQueue.Enqueue(e.Message);
                            }
                            finally
                            {
                                _schedulerProvider.MainThread.Schedule(() =>
                                {
                                    IsBusy = false;
                                    OnPropertyChanged("SelectedTable");
                                });
                            }
                        });
                    }
                    else
                    {
                        _newRelationships.ToList().ForEach((r) =>
                        {
                            var child = SelectedTable.Children.FirstOrDefault(t => t.name.Equals(r.toTable));
                            if (child != null)
                            {
                                child.DataTable = child.ToDataTable();
                            }
                        });

                        OnPropertyChanged("SelectedTable");
                        _newRelationships.Clear();
                        IsBusy = false;
                    }
                }
            }
        }
コード例 #11
0
        public void OnAddPingCommand(object parameter)
        {
            AddPingDialog pd = new AddPingDialog(pings);

            DialogHost.Show(pd); //, ClosingEventHandler);
        }
コード例 #12
0
ファイル: Home.xaml.cs プロジェクト: lucasroque/Checkpoint
 private async void InfoButton_OnClick(object sender, RoutedEventArgs e)
 {
     AboutModal aboutModal = new AboutModal();
     Boolean    result     = (Boolean)await DialogHost.Show(aboutModal);
 }
コード例 #13
0
ファイル: ErrorView.xaml.cs プロジェクト: collenirwin/LogBook
 /// <summary>
 /// Initialize the view with a host
 /// </summary>
 /// <param name="dialogHost">Dialog host showing this view</param>
 public ErrorView(DialogHost dialogHost)
 {
     InitializeComponent();
     _dialogHost = dialogHost;
 }
コード例 #14
0
 private void OpenWin_AddRule_Click(object sender, RoutedEventArgs e)
 {
     DialogHost.Show(new UserControl_RuleAdd());
     //DialogHost.Show(new UserControl_JCRuleAdd());
 }
コード例 #15
0
 private void OpenWin_AddStudentMsg_Click(object sender, RoutedEventArgs e)
 {
     DialogHost.Show(new UserControl_StudentMsgAdd());
     //DialogHost.Show(new UserControl_OpenWin());
 }
コード例 #16
0
        public void EditSettings_Click(object sender, RoutedEventArgs e)
        {
            EditSettingsViewModel editVm = new EditSettingsViewModel();

            DialogHost.Show(editVm, "RootDialog", EditSettingsDialogClosingEventHandler);
        }
コード例 #17
0
 private void btnXoaTheoThoiGian_Click(object sender, RoutedEventArgs e)
 {
     DialogHost.Show(new SalaryDeleteByTime(), "RootDialog");
 }
コード例 #18
0
 private async void EditCostGroups(object obj)
 {
     Wizards.EditGroupNames egn;
     egn = new Wizards.EditGroupNames();
     var result = await DialogHost.Show(egn, "RootDialog", ExtendedOpenedEventHandler, ExtendedClosingCostGroupsEventHandler);
 }
コード例 #19
0
ファイル: Bookmark.xaml.cs プロジェクト: Terkiss/Koromo-Copy
        private async Task classify_move(string from, string to, bool copy)
        {
            var name        = from.Split('/').Last();
            var from_parent = from.Remove(from.Length - name.Length);
            var warning     = false;
            var not_valid   = false;

            if (to == "/")
            {
                foreach (var ss in BookmarkModelManager.Instance.Model.root_classes)
                {
                    if (ss == "/" + name)
                    {
                        warning = true;
                    }
                }
            }
            else
            {
                foreach (var ss in BookmarkModelManager.Instance.Model.sub_classes)
                {
                    if (ss.Item1 == to && ss.Item2 == name)
                    {
                        warning = true;
                    }
                }
            }

            if (from.Remove(from.Length - from.Split('/').Last().Length - 1) == to)
            {
                not_valid = true;
            }

            if (warning || not_valid)
            {
                if (!not_valid)
                {
                    var dialog_error = new BookmarkMessage($"경고! {to}에 이미 {name}이 존재하기 때문에 {(copy ? "복사할" : "옮길")} 수 없어요!\r\n그래도 모든 경고를 무시하고 {(copy ? "복사를" : "이동을")} 진행할까요?\r\n하위 항목들은 자동으로 합쳐져요.");
                    if (!(bool)(await DialogHost.Show(dialog_error, "BookmarkDialog")))
                    {
                        return;
                    }
                }
                else
                {
                    var dialog_error = new BookmarkMessageOk($"부모로 바로 연결되는 상위 분류로는 {(copy ? "복사할" : "옮길")} 수 없어요!");
                    await DialogHost.Show(dialog_error, "BookmarkDialog");

                    return;
                }
            }

            if (to == "/")
            {
                to = "";
            }
            var dialog = new BookmarkMessage($"{name}을 {from_parent}에서 {to + "/"}로 {(copy ? "복사할" : "옮길")}까요?");

            if ((bool)(await DialogHost.Show(dialog, "BookmarkDialog")))
            {
                if (copy)
                {
                    copyto(from, to);
                }
                else
                {
                    moveto(from, to);
                }
                BookmarkModelManager.Instance.Save();
                init();
            }
        }
コード例 #20
0
 private async void EditSettings(object obj)
 {
     Wizards.EditSettings es;
     es = new Wizards.EditSettings();
     var result = await DialogHost.Show(es, "RootDialog", ExtendedOpenedEventHandler, ExtendedClosingEditSettingsEventHandler);
 }
コード例 #21
0
        private void btn_bayar_Click(object sender, RoutedEventArgs e)
        {
            var showdialog = new dialogBayar(total, invoice, tgl_bayar.SelectedDate.Value, idSewa);

            DialogHost.Show(showdialog, "MainDialog", ClosingEventHandler);
        }
コード例 #22
0
 private async void EditCostVatRates(object obj)
 {
     Wizards.EditInvoiceVatRates evr;
     evr = new Wizards.EditInvoiceVatRates();
     var result = await DialogHost.Show(evr, "RootDialog", ExtendedOpenedEventHandler, ExtendedClosingVatRatesEventHandler);
 }
コード例 #23
0
        public static async Task ShowSaveWadOperationDialog(string wadLocation, WadViewModel wad)
        {
            SaveWadOperationDialog dialog = new SaveWadOperationDialog(wadLocation, wad);

            await DialogHost.Show(dialog, "OperationDialog", dialog.Save, null);
        }
コード例 #24
0
        private async void Submit(string obj)
        {
            try
            {
                var newemp = new Account()
                {
                    Address   = Address,
                    Avatar    = ImgEmp.ConvertToByte(),
                    UserName  = UserName,
                    NameLogin = NameLogin,
                    Phone     = Phone,
                    DOB       = Convert.ToDateTime(DOB),
                };


                if (IsB)
                {
                    newemp.Sex = true;
                }
                if (IsG)
                {
                    newemp.Sex = false;
                }

                if (IsE == true)
                {
                    newemp.Role = 1;
                }

                if (string.IsNullOrEmpty(obj))
                {
                    //Create new customer

                    var objresult = await employee_Repo.Add(newemp);

                    if (objresult != null)
                    {
                        dc = new DialogContent()
                        {
                            Content = "Thêm Thành Công", Tilte = "Thông Báo"
                        };
                        dialog = new DialogOk()
                        {
                            DataContext = dc
                        };
                        DialogHost.CloseDialogCommand.Execute(null, null);
                        await DialogHost.Show(dialog, DialogHostId);

                        ListAccount.Add(objresult);
                    }
                    else
                    {
                        dc = new DialogContent()
                        {
                            Content = "Thêm Thất Bại", Tilte = "Thông Báo"
                        };
                        dialog = new DialogOk()
                        {
                            DataContext = dc
                        };
                        DialogHost.CloseDialogCommand.Execute(null, null);
                        await DialogHost.Show(dialog, DialogHostId);
                    }
                }
                else
                {
                    //update customer

                    newemp.EmpID = Convert.ToInt32(obj);

                    if (await employee_Repo.Update(newemp))
                    {
                        dc = new DialogContent()
                        {
                            Content = "Cập Nhật Thành Công", Tilte = "Thông Báo"
                        };
                        dialog = new DialogOk()
                        {
                            DataContext = dc
                        };
                        DialogHost.CloseDialogCommand.Execute(null, null);
                        await DialogHost.Show(dialog, DialogHostId);

                        ListAccount = new ObservableCollection <Account>(await employee_Repo.GetAllAsync());
                    }
                    else
                    {
                        dc = new DialogContent()
                        {
                            Content = "Cập Nhật Thất Bại", Tilte = "Thông Báo"
                        };
                        dialog = new DialogOk()
                        {
                            DataContext = dc
                        };
                        DialogHost.CloseDialogCommand.Execute(null, null);
                        await DialogHost.Show(dialog, DialogHostId);
                    }
                }
            }
            catch
            {
                dc.Content = "Có Lỗi";
                dc.Tilte   = "Thông Báo";
                dialog     = new DialogOk()
                {
                    DataContext = dc
                };
                DialogHost.CloseDialogCommand.Execute(null, null);
                await DialogHost.Show(dialog, DialogHostId);
            }
        }
コード例 #25
0
        public static async Task ShowSyncingLocalizationsDialog()
        {
            SyncingLocalizationsDialog dialog = new SyncingLocalizationsDialog();

            await DialogHost.Show(dialog, "OperationDialog", dialog.StartSyncing, null);
        }
コード例 #26
0
ファイル: AddTrain.xaml.cs プロジェクト: sdc224/IRCTCSoftware
        /// <summary>
        /// The button add on click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private async void ButtonAddOnClick([CanBeNull] object sender, [CanBeNull] RoutedEventArgs e)
        {
            try
            {
                if (string.Compare(this.currentSelectedItem, "Coach", StringComparison.Ordinal) == 0)
                {
                    var dialog1 = new SelectionDialog {
                        DataContext = new SelectCoachCategoryViewModel()
                    };

                    var result1 = await DialogHost.Show(dialog1, "RootDialog")
                                  .ConfigureAwait(false);

                    if ((bool)result1)
                    {
                        this.Dispatcher.Invoke(
                            () =>
                        {
                            var coaches = this.root.Items ?? throw new InvalidOperationException();

                            var item = new MenuItem {
                                Name = DataHelper.SelectedCoach
                            };

                            if (!coaches.Contains(item))
                            {
                                coaches.Add(item);
                            }

                            this.TreeView.Items[0] = this.root;
                        });
                    }
                }
                else
                {
                    var o = this.list;
                    if (o?.Contains(this.currentSelectedItem) == true)
                    {
                        DataHelper.SelectedCoach = (this.list ?? throw new InvalidOperationException()).FirstOrDefault(
                            a => a.Contains(this.currentSelectedItem ?? throw new InvalidOperationException()));
                        var dialog2 = new SelectionDialog {
                            DataContext = new EnterCoachesViewModel()
                        };

                        var result2 = await DialogHost.Show(dialog2, "RootDialog")
                                      .ConfigureAwait(false);

                        if ((bool)result2)
                        {
                            this.Dispatcher.Invoke(
                                () =>
                            {
                                var coaches =
                                    (this.root.Items ?? throw new InvalidOperationException()).FirstOrDefault(
                                        c => c.Name == DataHelper.SelectedCoach);

                                if (DataHelper.CoachesList != null)
                                {
                                    foreach (var coach in DataHelper.CoachesList)
                                    {
                                        coaches?.Items?.Add(new MenuItem {
                                            Name = coach
                                        });
                                    }
                                }

                                this.TreeView.Items[0] = this.root;
                            });
                        }
                    }
                    else
                    {
                        MessageBox.Show("Invalid request!");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #27
0
        public async Task WhenContentIsNullItThrows()
        {
            var ex = await Assert.ThrowsAsync <ArgumentNullException>(() => DialogHost.Show(null));

            Assert.Equal("content", ex.ParamName);
        }
コード例 #28
0
 private async void ShowBuggyDialog()
 {
     await DialogHost.Show(new MessageDialog("Before going back from Builds and Counters page, switch to another tab and go back; it is a known bug. Also Riot API data might be wrong so some invalid data might appear at spells page. If you see something weird, please tell it to the author."));
 }
コード例 #29
0
ファイル: Tools.cs プロジェクト: yimouleng/SteamCleaner
        public static async void CheckForUpdates()
        {
            if (HasInternetConnection)
            {
                try
                {
                    var          _releasePageURL = "";
                    Version      _newVersion     = null;
                    const string _versionConfig  = "https://raw.github.com/Codeusa/SteamCleaner/master/version.xml";
                    var          _reader         = new XmlTextReader(_versionConfig);
                    _reader.MoveToContent();
                    var _elementName = "";
                    try
                    {
                        if ((_reader.NodeType == XmlNodeType.Element) && (_reader.Name == "steamcleaner"))
                        {
                            while (_reader.Read())
                            {
                                switch (_reader.NodeType)
                                {
                                case XmlNodeType.Element:
                                    _elementName = _reader.Name;
                                    break;

                                default:
                                    if ((_reader.NodeType == XmlNodeType.Text) && _reader.HasValue)
                                    {
                                        switch (_elementName)
                                        {
                                        case "version":
                                            _newVersion = new Version(_reader.Value);
                                            break;

                                        case "url":
                                            _releasePageURL = _reader.Value;
                                            break;
                                        }
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                    finally
                    {
                        _reader.Close();
                    }

                    var applicationVersion = Assembly.GetExecutingAssembly().GetName().Version;
                    if (applicationVersion.CompareTo(_newVersion) < 0)
                    {
                        var dialog = new ConfirmationDialog
                        {
                            MessageTextBlock =
                            {
                                Text = "A new Steam Cleaner update is available, update now?"
                            }
                        };

                        var result = await DialogHost.Show(dialog);

                        if ("1".Equals(result))
                        {
                            GotoSite(_releasePageURL);
                        }
                    }
                }
                catch
                {
                    // ignored
                }
            }
        }
コード例 #30
0
 private async void BlorbButton_OnClick(object sender, RoutedEventArgs e)
 {
     MainWindow.Instance.RootDialog.IsOpen = false;
     await DialogHost.Show(new MessageDialog(ChampionViewModel.Champion.Blurb));
 }
コード例 #31
0
 private async void add_Click(object sender, RoutedEventArgs e)
 {
     var result = await DialogHost.Show(new AppointmentEditAddDialog(new Appointment()), "RootDialog", ExtendedAddSecClosingEventHandler);
 }
コード例 #32
0
 public virtual void Show()
 {
     DialogHost.Show(this, OnDialogOpened, OnDialogClosing);
 }