public RecordManageWindowViewModel()
 {
     if (this.IsInDesignMode)
     {
         record = new UpdateModelWrapper(new DesigntimeUpdateModel());
     }
     else
     {
         DomainsCache = MonitorIoc.Current.Get<DomainsCache>();
         TempStorage = MonitorIoc.Current.Get<TempStorage>();
         record = TempStorage.GetAndRemove<UpdateModelWrapper>(DDNSMonitorWindowViewModel.RECORD_FETCH_KEY);
         if (record == null)
             record = new UpdateModelWrapper()
             {
                 Enabled = true
             };
         if (DomainsCache.DomainInfos.Count() <= 0)
             RefreshDataCommand.Execute(null);
         else
             BindData();
     }
 }
Пример #2
0
        private void DeleteRecrod(UpdateModelWrapper um)
        {
            var mbr = MessageBox.Show("请确认操作.", "注意", MessageBoxButton.YesNo);
            if (mbr == MessageBoxResult.Yes)
            {
                Runtime.UpdateList.Remove(um);

                DDnsSharpRuntime.AppConfig.UpdateList = (from w in Runtime.UpdateList
                                                         select w.UnWrap()).ToList();
                DDnsSharpRuntime.SaveAppConfig();
            }
        }
Пример #3
0
        private void OnRecordManaged(UpdateModelWrapper obj)
        {
            if (Runtime.UpdateList.Count(m => m == obj) <= 0)
            {
                Runtime.UpdateList.Add(obj);
            }

            DDnsSharpRuntime.AppConfig.UpdateList = (from w in Runtime.UpdateList
                                                     select w.UnWrap()).ToList();
            DDnsSharpRuntime.SaveAppConfig();
        }