public GuitarTrack(TrackEditor owner, bool isPro) { this.owner = owner; this.IsPro = isPro; this.dirtyItems = DirtyItem.None; }
public GuitarTrack SetTrack(Track selectedTrack, GuitarDifficulty diff) { if (selectedTrack == null || midiTrack == null) { midiTrack = null; dirtyItems |= DirtyItem.Track; } if (selectedTrack != null) { if (midiTrack == selectedTrack && !midiTrack.Dirty && currentDifficulty == diff && dirtyItems == DirtyItem.None) { } else { midiTrack = selectedTrack; currentDifficulty = diff; if (midiTrack == null || midiTrack.Sequence == null) { this.SequenceDivision = 480; } else { this.SequenceDivision = midiTrack.Sequence.Division; } RebuildEvents(); this.dirtyItems = DirtyItem.None; selectedTrack.Dirty = false; } } return(this); }
/// <summary> /// 验证数据是否一致,添加数据到数据集合中,不一致的数据同时添加到数据不一致的数据集合中。 /// </summary> /// <param name="key">数据表字段</param> /// <param name="newValue">字段新值</param> protected virtual void ValidateDirtyList(string key, string newValue) { bool IsExist = false; DirtyItem dItem = new DirtyItem(); //数据集合中包含该字段的记录。 if (_dataList.ContainsKey(key)) { IsExist = true; dItem = _dataList[key]; } dItem.FieldName = key; //没有初始化完成。 if (_isInitializeFinished == false) { dItem.FieldOriginalValue = newValue; } dItem.FieldNewValue = newValue; //如果不存在,添加到数据集合中。 if (!IsExist) { _dataList.Add(key, dItem); } //初始化完成。 if (_isInitializeFinished == true) { //字段新值和字段旧值不一致。 if (dItem.FieldOriginalValue != dItem.FieldNewValue) { //将数据添加到不一致的数据集合中。 if (_dirtyList.ContainsKey(key)) { _dirtyList[key] = dItem; } else { _dirtyList.Add(key, dItem); } } else//字段新值和字段旧值一致。 { //如果数据不一致的集合中包含该字段,则移除该字段。 if (_dirtyList.ContainsKey(key)) { _dirtyList.Remove(key); } } } }
bool LoadEvents6() { bool ret = true; try { GetMessages(CurrentDifficulty); NoteGrid = new NoteGrid(owner); ret = true; this.dirtyItems = DirtyItem.None; } catch { ret = false; } return(ret); }
/// <summary> /// Validate dirty data /// </summary> /// <param name="key">Table fields</param> /// <param name="newValue">New value</param> protected virtual void ValidateDirtyList(string key, string newValue) { bool IsExist = false; DirtyItem dItem = new DirtyItem(); if (_dataList.ContainsKey(key)) { IsExist = true; dItem = _dataList[key]; } dItem.FieldName = key; if (_isInitializeFinished == false) { dItem.FieldOriginalValue = newValue; } dItem.FieldNewValue = newValue; if (!IsExist) { _dataList.Add(key, dItem); } if (_isInitializeFinished == true) { if (dItem.FieldOriginalValue != dItem.FieldNewValue) { if (_dirtyList.ContainsKey(key)) { _dirtyList[key] = dItem; } else { _dirtyList.Add(key, dItem); } } else { if (_dirtyList.ContainsKey(key)) { _dirtyList.Remove(key); } } } }
public GuitarTrack SetTrack(Track selectedTrack, GuitarDifficulty diff) { if (selectedTrack == null || midiTrack == null) { midiTrack = null; dirtyItems |= DirtyItem.Track; } if (selectedTrack != null) { if (midiTrack == selectedTrack && !midiTrack.Dirty && currentDifficulty == diff && dirtyItems == DirtyItem.None) { } else { midiTrack = selectedTrack; currentDifficulty = diff; if (midiTrack == null || midiTrack.Sequence == null) { this.SequenceDivision = 480; } else { this.SequenceDivision = midiTrack.Sequence.Division; } RebuildEvents(); this.dirtyItems = DirtyItem.None; selectedTrack.Dirty = false; } } return this; }
public void RemoveTrack(Track t) { if (Sequence.Contains(t)) { Sequence.Remove(t); } this.dirtyItems |= DirtyItem.All; }
public void AddTrack(Track t) { if (!Sequence.Contains(t)) { this.Sequence.Add(t); } this.dirtyItems |= DirtyItem.All; }
public void AddTempoTrack(Track t) { if (t == null || t.Name == null) return; try { if (!Sequence.Contains(t)) { Sequence.AddTempo(t); } } catch { } dirtyItems |= DirtyItem.All; }
bool LoadEvents6() { bool ret = true; try { GetMessages(CurrentDifficulty); NoteGrid = new NoteGrid(owner); ret = true; this.dirtyItems = DirtyItem.None; } catch { ret = false; } return ret; }
public void SaveResource(bool bNew, DataSet dataSet) { DataSet dsReturn = new DataSet(); DataSet ds = new DataSet(); if (bNew) { ds = dataSet; } else { if (IsDirty) { if (this.DirtyList.Count > 0) { if (DirtyList.ContainsKey(RBAC_RESOURCE_FIELDS.FIELD_RESOURCE_CODE)) { DirtyItem dItem = new DirtyItem(); dItem.FieldOriginalValue = ""; dItem.FieldNewValue = _resourceGroupKey; DirtyList.Add(RBAC_RESOURCE_FIELDS.FIELD_RESOURCE_GROUP_KEY, dItem); } DataTable resourceTable = DataTableHelper.CreateDataTableForUpdateBasicData(RBAC_RESOURCE_FIELDS.DATABASE_TABLE_NAME); foreach (string Key in DirtyList.Keys) { Dictionary <string, string> rowData = new Dictionary <string, string>() { { COMMON_FIELDS.FIELD_COMMON_UPDATE_KEY, _resourceKey }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NAME, Key }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_OLD_VALUE, this.DirtyList[Key].FieldOriginalValue }, { COMMON_FIELDS.FIELD_COMMON_UPDATE_NEW_VALUE, this.DirtyList[Key].FieldNewValue } }; FanHai.Hemera.Utils.Common.Utils.AddRowDataToDataTable(ref resourceTable, rowData); } if (resourceTable.Rows.Count > 0) { ds.Tables.Add(resourceTable); } } } } try { IServerObjFactory serverFactory = CallRemotingService.GetRemoteObject(); if (null != serverFactory) { if (bNew) { dsReturn = serverFactory.CreateIResourceEngine().AddResource(ds); } else { dsReturn = serverFactory.CreateIResourceEngine().UpdateResource(ds); } _errorMsg = FanHai.Hemera.Share.Common.ReturnMessageUtils.GetServerReturnMessage(dsReturn); } } catch (Exception ex) { _errorMsg = ex.Message; } finally { CallRemotingService.UnregisterChannel(); } }