Пример #1
0
 public string GetProgress(ProgressModel progressModel)
 {
     progressModel.Sqlprms    = new SqlParameter[1];
     progressModel.Sqlprms[0] = new SqlParameter("@ProgressCD", progressModel.ProgressCD);
     //progressModel.Sqlprms[0] = new SqlParameter("@ProgressRate", progressModel.ProgressRate);
     return(cKMDL.SelectJson("Progress_Select", ff.GetConnectionWithDefaultPath("PJMS"), progressModel.Sqlprms));
 }
Пример #2
0
 public void UpdateProgress(ProgressModel model)
 {
     using (IDbConnection connection = new NpgsqlConnection(GlobalConfig.getDatabaseConnectionString()))
     {
         connection.ExecuteScalar($"update progress set progress_id = '{model.progress_id}', progress_name = '{model.progress_name}'");
     }
 }
Пример #3
0
        public async Task LoadModelAsync(ObservableCollection <Node> nodes, ProgressModel progress)
        {
            var root       = "http://" + _settings.ServerHost + _settings.RestUrl;
            var rootfolder = root + "/|";

            await LoadModelAsync(nodes, null, rootfolder, progress);
        }
Пример #4
0
    /**
     * For internal use
     **/
    public void ProgressMessage(string message)
    {
        Debug.Log("ProgressMessage received:" + message);
        ProgressModel model = new ProgressModel(message);

        OnProgress(model);
    }
        public MainViewModel(string[] args)
        {
            BindingOperations.EnableCollectionSynchronization(Xmls, new object());
            Progress = new ProgressModel();
#if DEBUG
            Schema = new DocumentSchemaModel(@"C:\Users\ehirakawa\Source\Workspaces\Schematron Learning\testdata\tournament.iso\tournament-schema.sch");
#endif
        }
Пример #6
0
 public ProgressModel CreateProgress(ProgressModel model)
 {
     using (IDbConnection connection = new NpgsqlConnection(GlobalConfig.getDatabaseConnectionString()))
     {
         int id = connection.ExecuteScalar <int>($"insert into progress values(default,'{model.progress_id}','{model.progress_name}'");
         return(model);
     }
 }
 public ActionResult ProgressEntry(ProgressModel progressModel)
 {
     if (string.IsNullOrWhiteSpace(progressModel.Mode))
     {
         progressModel.Mode = "New";
     }
     return(View(progressModel));
 }
 protected WorkerWithProgress()
 {
     ProgressModel = new ProgressModel
     {
         Progress = 0,
         Status   = ProgressModel.ProgressStatus.Running
     };
 }
Пример #9
0
        void ProgressHandler(ProgressModel progressModel)
        {
            if (progressModel == null) return;

            ProgressValue = progressModel.Value;
            StatusText = progressModel.Caption;
            State = progressModel.State;
        }
Пример #10
0
        public AddProgressViewModel(ProgressModel progress, IWeightAppClient client)
        {
            _progress = progress;
            _client   = client;

            TrackProgress = new RelayCommand(TrackProgressExecute);
            Cancel        = new RelayCommand(CancelExecute);
        }
Пример #11
0
 public void StartIndeterminate(ProgressType type)
 {
     if (!_progressModels.ContainsKey(type))
     {
         _progressModels[type] = new ProgressModel(type);
     }
     ActiveProgressChanged?.Invoke(this, EventArgs.Empty);
 }
    /* *
     * Event that will be called with information about the progress of currently downloading file,
     * multiple files can be downloaded at the same time on Android, so this event will be called for each of them.
     * */
    void EventProgress(ProgressModel progress)
    {
        statusText.text = "Progress: " + progress.mProgress + "%" +
                          " File in group " + progress.mGroupPosition + "/" + progress.mGroupSize +
                          " File: " + ((progress.mFile != null)?progress.mFile.mFilePath:" no file info") +
                          " State: " + progress.mProgressType;

        progressSlider.value = (float)progress.mProgress;
    }
        public void UpdateProgressControl(ProgressModel progressModel)
        {
            var progressControl = ProgressLedger[progressModel];

            progressControl.UpdateProgress(progressModel);
            if (progressModel.Status != ProgressModel.ProgressStatus.Running)
            {
                RemoveProgressControl(progressModel);
            }
        }
Пример #14
0
 public string ProgressCUD(ProgressModel progressModel)
 {
     cKMDL.UseTran            = true;
     progressModel.Sqlprms    = new SqlParameter[4];
     progressModel.Sqlprms[0] = new SqlParameter("@ProgressCD", progressModel.ProgressCD);
     progressModel.Sqlprms[1] = new SqlParameter("@ProgressName", progressModel.ProgressName);
     progressModel.Sqlprms[2] = new SqlParameter("@UpdatedBy", progressModel.UpdatedBy);
     progressModel.Sqlprms[3] = new SqlParameter("@Mode", progressModel.Mode);
     return(cKMDL.InsertUpdateDeleteData("Progress_CUD", ff.GetConnectionWithDefaultPath("PJMS"), progressModel.Sqlprms));
 }
        public void CreateProgressControl(ProgressModel progressModel)
        {
            var progressControl = new ProgressControl(progressModel);

            StackPanel.Children.Add(progressControl);
            ProgressLedger.Add(progressModel, progressControl);
            ResizeWindow();
            RepositonWindow();
            Show();
        }
Пример #16
0
        public static async Task ConvertAsync(GifModel.Config config, ProgressModel progress, CancellationToken ct)
        {
            Debug.Assert(IsAvailable());

            var p = new Process
            {
                StartInfo =
                {
                    UseShellExecute       = false,
                    WindowStyle           = ProcessWindowStyle.Hidden,
                    CreateNoWindow        = true,
                    RedirectStandardError = true,
                    FileName  = Path,
                    Arguments = $"-framerate {config.FramesPerSecond} -i \"{config.TmpFilename}%4d.png\" -c:v libx264 -preset veryslow -crf 1 -pix_fmt yuv420p -frames:v {config.FramesPerSecond * config.NumSeconds} -r {config.FramesPerSecond} \"{config.Filename}\""
                }
            };
            var numFrames = config.NumSeconds * config.FramesPerSecond;

            progress.What = "converting";

            // progress reports
            p.ErrorDataReceived += (sender, args) =>
            {
                if (args.Data == null)
                {
                    return;
                }

                if (args.Data.StartsWith("frame="))
                {
                    if (int.TryParse(args.Data.Substring("frame=".Length), out var frame))
                    {
                        progress.Progress = frame / (float)numFrames;
                    }
                }
            };

            if (!p.Start())
            {
                throw new Exception("could not start ffmpeg.exe");
            }

            p.BeginErrorReadLine();

            while (!p.HasExited)
            {
                await Task.Run(() => p.WaitForExit(100));

                if (ct.IsCancellationRequested && !p.HasExited)
                {
                    p.Kill();
                    ct.ThrowIfCancellationRequested();
                }
            }
        }
Пример #17
0
        public CustomerViewModel()
        {
            progressModel = new ProgressModel()
            {
                IsBusy = false
            };
            customer = new Customer()
            {
                ID = 1, Name = "Mohsin", IsChecked = false
            };

            Customers = new ObservableCollection <Customer>();
            Customers.CollectionChanged += Customers_CollectionChanged;

            ButtonCommand       = new DelegateCommand(Display);
            GridDoubleClick     = new DelegateCommand(DoubleClick);
            GridRightClick      = new DelegateCommand(RightClick);
            SaveCommand         = new DelegateCommandT <object>(ExecSaveCommand, CanExecuteSaveCommand);
            EmployeeDisplayName = DisplayAttributeConverter.GetMemberName((Customer c) => c.Name);
            int[] arr = new int[8] {
                1, 5, 0, 9, 7, 4, 10, 4
            };

            int max = 0, nmax = 0;

            for (int i = 0; i < arr.Length; i++)
            {
                // nmax = arr[i];
                if (arr[i] > max)
                {
                    nmax = max;
                    max  = arr[i];
                }
                if (i == 0)
                {
                    nmax = arr[i];
                }
            }
            int p = 0;

            Type t = Type.GetType("ECommerce.ViewModel.CustomerViewModel");

            ad = new AttributeDictionary();
            ad.GetAttributes(typeof(Customer));
            foreach (var item in ad.DisplayAttribute)
            {
            }
            OnWindowClosing = new DelegateCommand(() =>
            {
                Dispose();
            }
                                                  );

            //t.InvokeMember("GridDoubleClick",BindingFlags.Default,null,null,null);
        }
Пример #18
0
        void ProgressHandler(ProgressModel progressModel)
        {
            if (progressModel == null)
            {
                return;
            }

            ProgressValue = progressModel.Value;
            StatusText    = progressModel.Caption;
            State         = progressModel.State;
        }
Пример #19
0
 public void BindProgressObj(ProgressModel p)
 {
     progressbar.DataContext  = null;
     lblStatus.DataContext    = null;
     lblProgCur.DataContext   = null;
     lblProgTotal.DataContext = null;
     progressbar.DataContext  = p;
     lblStatus.DataContext    = p;
     lblProgCur.DataContext   = p;
     lblProgTotal.DataContext = p;
 }
 private void RemoveProgressControl(ProgressModel progressModel)
 {
     StackPanel.Children.Remove(ProgressLedger[progressModel]);
     ProgressLedger.Remove(progressModel);
     if (!ProgressLedger.Any())
     {
         Hide();
         return;
     }
     ResizeWindow();
     RepositonWindow();
 }
Пример #21
0
        public ServerExportViewModel()
        {
            _settingsManager = new SettingsManager();
            Settings         = _settingsManager.GetSettings();
            Nodes            = new ObservableCollection <Node>();
            DestinCommand    = new RelayCommand(null, null);
            ExportCommand    = new RelayCommand(Export, null);
            LoadModelCommand = new RelayCommand(StartLoadModelAsync, null);
            Progress         = new ProgressModel();

            Settings.PropertyChanged += Settings_PropertyChanged;
        }
Пример #22
0
 public void Start(ProgressType type, int maxValue)
 {
     if (!_progressModels.ContainsKey(type))
     {
         _progressModels[type] = new ProgressModel(type, maxValue);
     }
     else
     {
         _progressModels[type].OverwriteMaxValue(maxValue);
     }
     ActiveProgressChanged?.Invoke(this, EventArgs.Empty);
 }
Пример #23
0
        public bool SetProgress(ProgressModel progress, List <TaskModel> tasks)
        {
            using (var conn = new SqlConnection(_connectString))
            {
                conn.Open();
                using (var cmd = conn.CreateCommand())
                    using (var sqlTran = conn.BeginTransaction())
                    {
                        try
                        {
                            cmd.Transaction = sqlTran;
                            cmd.CommandText = @"
INSERT 
INTO 
[dbo].[Progresses] 
OUTPUT INSERTED.Id
VALUES
    (@UserId, 
    @Title, 
    @DateTime_Registered,
    @Number_Of_Items, 
    @Password);";
                            cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.NVarChar, 50)).Value          = progress.UserId;
                            cmd.Parameters.Add(new SqlParameter("@Title", SqlDbType.NVarChar, 50)).Value           = progress.Title;
                            cmd.Parameters.Add(new SqlParameter("@DateTime_Registered", SqlDbType.DateTime)).Value = progress.DateTimeRegistered;
                            cmd.Parameters.Add(new SqlParameter("@Number_Of_items", SqlDbType.Int)).Value          = progress.NumberOfTask;
                            cmd.Parameters.Add(new SqlParameter("@Password", SqlDbType.NVarChar, 50)).Value        = progress.Password;
                            int newId = (int)cmd.ExecuteScalar();

                            foreach (var task in tasks)
                            {
                                cmd.Parameters.Clear();
                                cmd.CommandText = @"
INSERT
INTO [dbo].[Tasks]
VALUES
    (@ProgressId,
    @Task)";
                                cmd.Parameters.Add(new SqlParameter("@ProgressId", SqlDbType.Int)).Value = newId;
                                cmd.Parameters.Add(new SqlParameter("@Task", SqlDbType.NVarChar)).Value  = task.Task;
                                cmd.ExecuteNonQuery();
                            }
                            sqlTran.Commit();
                            return(true);
                        }
                        catch
                        {
                            throw;
                        }
                    }
            }
        }
        public void SetValueTest()
        {
            ProgressModel progress = new ProgressModel();

            progress.SetValue(0, 0);
            Assert.AreEqual(0, progress.Value);
            progress.SetValue(1, 0);
            Assert.AreEqual(0, progress.Value);
            progress.SetValue(1, 10);
            Assert.AreEqual(10, progress.Value);
            progress.SetValue(10, 10);
            Assert.AreEqual(100, progress.Value);
        }
Пример #25
0
        public override void PreLoad()
        {
            HarmonyInstance.PatchAll();
            SRML.Console.Console.RegisterCommand(new ChangeVacVisualCommand());
            SaveRegistry.RegisterDataParticipant <PlortUndisappearifier>();

            LookupRegistry.RegisterUpgradeEntry(Ids.MOCHI_HACK, Main.assetBundle.LoadAsset <Sprite>("upgrade_initial"), 10000);

            Ids.MOCHI_HACK.GetTranslation().SetDescriptionTranslation("Hack the gate at Mochi's Manor to make it ineffective and go in/out with your normal inventory. But you have to be careful, Mochi may or may not see when her precious quicksilver slimes disappear, and if that happens, she will attack your base, trying to take them back!").SetNameTranslation("Gate Hack");
            PersonalUpgradeRegistry.RegisterUpgradeLock(Ids.MOCHI_HACK, (PlayerState x) => x.CreateBasicLock(null, delegate
            {
                ProgressModel model = SRSingleton <SceneContext> .Instance.ProgressDirector.model;
                return(model != null && model.HasProgress(ProgressDirector.ProgressType.ENTER_ZONE_MOCHI_RANCH));
            }, 0f));
        }
Пример #26
0
        public static Progress CreateProgress(ProgressModel progress, User user)
        {
            var result = new Progress(
                progress.Weight,
                progress.Date)
            {
                DateCreated  = DateTime.Now,
                DateModified = DateTime.Now,
                CreatedBy    = "Admin",
                ModifiedBy   = "Admin",
                UserId       = user.Id
            };

            return(result);
        }
Пример #27
0
        internal ExportModel(SharedModel shared, ProgressModel progress)
        {
            this.progress = progress;
            convert       = shared.Convert;

            var formats = new List <ExportFormatModel>();

            formats.Add(new ExportFormatModel("png"));
            formats.Add(new ExportFormatModel("jpg"));
            formats.Add(new ExportFormatModel("bmp"));
            formats.Add(new ExportFormatModel("hdr"));
            formats.Add(new ExportFormatModel("pfm"));
            formats.Add(new ExportFormatModel("dds"));
            formats.Add(new ExportFormatModel("ktx"));
            Formats = formats;
        }
Пример #28
0
 public void PlaySkillProgress(ProgressModel PlayModel, float fContinTime)
 {
     gameObject.SetActive(true);
     if (PlayModel == ProgressModel.ORDERMODEL)
     {
         m_ProgressSlider.value = 0;
     }
     else if (PlayModel == ProgressModel.REVERSEDMODE)
     {
         m_ProgressSlider.value = 1;
     }
     m_playModel     = PlayModel;
     m_fContinueTime = fContinTime;
     m_fElapseTime   = 0.0f;
     m_fRecordTime   = Time.time;
 }
Пример #29
0
        private void TrackProgressExecute(object obj)
        {
            var progressModel = new ProgressModel {
                GoalId = SelectedGoal.GoalId, Date = DateTime.Now
            };
            var newProgessViewModel = new AddProgressViewModel(progressModel, _client);

            var dialog = new TrackProgress();

            dialog.DataContext = newProgessViewModel;
            var result = dialog.ShowDialog();

            if (result.GetValueOrDefault())
            {
                Progress.Add(new ProgressViewModel(SelectedGoal, newProgessViewModel.Progress));
            }
        }
        public async Task <IResult <long> > AddAsync(ProgressModel model)
        {
            var validation = await new AddProgressModelValidator().ValidateAsync(model);

            if (validation.Failed)
            {
                return(Result <long> .Fail(validation.Message));
            }
            var user = await _userRepository.GetAsync(model.UserId);

            var Progress = ProgressFactory.CreateProgress(model, user);
            await _ProgressRepository.AddAsync(Progress);

            await _unitOfWork.SaveChangesAsync();

            return(Result <long> .Success(Progress.Id));
        }
Пример #31
0
        public static Task <TexInfo> LoadImageTextureAsync(string file, ProgressModel progress)
        {
            var task = Task.Run(() =>
            {
                var tex = LoadImageTexture(file, out var orig);
                return(new TexInfo
                {
                    Texture = tex,
                    OriginalFormat = orig
                });
            });

            var cts = new CancellationTokenSource();

            progress.AddTask(task, cts);

            return(task);
        }
Пример #32
0
		public void Add(ProgressModel progress)
		{
			Earned += progress.Earned;
			Total += progress.Total;
		}