private void ControllaPickers(FasciaOraria fo) { _editor.StartPicker.CanGoDown = fo.StartQuarter != 0 && _wrapper.Element[fo.StartQuarter - 1] == ProgrammazioneGiornaliera.SEQUENZA_DUMMY; _editor.StartPicker.CanGoUp = fo.CoveredQuarters != 1; _editor.EndPicker.CanGoDown = fo.CoveredQuarters != 1; _editor.EndPicker.CanGoUp = fo.EndQuarter != ProgrammazioneGiornaliera.QUARTERS_IN_DAY && _wrapper.Element[fo.EndQuarter] == ProgrammazioneGiornaliera.SEQUENZA_DUMMY; }
private void OnPickerChange(object sender, EventArgs args) { DateTime start = _editor.StartPicker.Value; DateTime end = _editor.EndPicker.Value; FasciaOraria fo = FasciaOraria.FromDateTime(start, end); _wrapper.Element.UpdateFasciaOraria(_currentSequenza, fo); UpdateLabels(); ControllaPickers(fo); }
private void VisualizzaEditorPer(Sequenza s) { if (null != _sequenzaEditor) { _editor.EditorContainer.Controls.Remove(_sequenzaEditor.Editor); } _sequenzaEditor = Documento.getInstance().EditorFactory.GetEditorHandler(s.GetType(), Documento.getInstance().ModelloRiferimento); _sequenzaEditor.CaricaModello(new PersisterMapper <Sequenza>(s)); _editor.EditorContainer.Controls.Add(_sequenzaEditor.Editor); _sequenzaEditor.Editor.BringToFront(); _editor.NomeField.Text = s.Nome; FasciaOraria fo = _wrapper.Element.GetFasciaOrariaOf(s); _currentSequenza = s; _editor.StartPicker.InitValue = fo.StartToDateTime(); _editor.EndPicker.InitValue = fo.EndToDateTime(); ControllaPickers(fo); }
private void SetSequenzaOnLabels(Sequenza s, FasciaOraria fasciaOraria, bool odd) { _editor.SuspendLayout(); int argb = ALPHA_CHANNEL | 200 << (odd ? 16 : 0); int startingNameIndex = fasciaOraria.CoveredQuarters < s.Nome.Length ? 0 : ((int)fasciaOraria.CoveredQuarters - s.Nome.Length) / 2; for (uint i = fasciaOraria.StartQuarter; i < fasciaOraria.EndQuarter; i++) { uint relativeIndex = i - fasciaOraria.StartQuarter; bool isInside = relativeIndex >= startingNameIndex && relativeIndex <= startingNameIndex + s.Nome.Length - 1; char content = isInside ? s.Nome.ToCharArray()[relativeIndex - startingNameIndex] : ' '; _editor.Labels[i].Text = String.Format("{0}", content); _editor.Labels[i].BackColor = Color.FromArgb(argb); _editor.Labels[i].BorderStyle = BorderStyle.None; _editor.Labels[i].ForeColor = Color.White; _editor.Labels[i].Tag = s; _editor.ToolTip.SetToolTip(_editor.Labels[i], s.Nome); _editor.Labels[i].DoubleClick += OnLabelDoubleClick; } _editor.ResumeLayout(); }
public ProgrammazioneGiornaliera Retrieve(BinaryReader br) { // Programmazione Giornaliera string nome = br.ReadString(); ProgrammazioneGiornaliera result = new ProgrammazioneGiornaliera(); result.Nome = nome; // Modello Modello modello = Documento.getInstance().ModelloRiferimento; int width = br.ReadInt32(); int height = br.ReadInt32(); if (width != modello.Size.Width || height != modello.Size.Height) { return(null); } // Sequenze SequenzaPersister persister = new SequenzaPersister(); Sequenza seq; FasciaOraria fo; string type; uint startQuarter, endQuarter; int count = br.ReadInt32(); for (int i = 0; i < count; i++) { type = br.ReadString(); seq = persister.Retrieve(br); startQuarter = br.ReadUInt32(); endQuarter = br.ReadUInt32(); fo = new FasciaOraria(startQuarter, endQuarter); result.InserisciSequenza(seq, fo); } // Out return(result); }