/// <summary> /// Refreshes A ComboBox's Source /// </summary> /// <param name="cb">The ComboBox To Refresh</param> /// <param name="bs">The Source Of The ComboBox</param> private void RefereshComboBox(ComboBox cb, BaseSingleton bs) { cb.ItemsSource = bs.AllObjects(); ICollectionView view = CollectionViewSource.GetDefaultView(cb.ItemsSource); view.Refresh(); }
public WizCadProfessorViewModel(BaseSingleton baseSingleton) { Base_ = baseSingleton; Prof = new AppFactory().NewProfessor(); FillCollections(); SetProperties(); }
public WizCadProfessorViewModel(Professor prof, BaseSingleton baseSingleton) { Base_ = baseSingleton; Prof = prof; FillCollections(); SetProperties(); }
/// <summary> /// Refreshes The List View /// </summary> /// <param name="bs"></param> protected void RefreshListView(BaseSingleton bs) { BaseListWindow.listviewCurrent.ItemsSource = bs.AllObjects(); ICollectionView view = CollectionViewSource.GetDefaultView(BaseListWindow.listviewCurrent.ItemsSource); view.Refresh(); }
public static BaseSingleton GetBaseSingleton() { if (baseSingleton == null) { baseSingleton = new BaseSingleton(); return(baseSingleton); } return(baseSingleton); }
public WizCadBoletimProfViewModel(BaseSingleton baseSingleton) { Falta = new AppFactory().NewFalta(); Base_ = baseSingleton; FillCollections(); SetProperties(); Base_.HeaderWizard = "Lançamento de Faltas de Professor"; }
static void Main(string[] args) { BaseSingleton c1 = BaseSingleton.GetBaseSingleton(); BaseSingleton c2 = BaseSingleton.GetBaseSingleton(); System.Console.WriteLine(c1.Equals(c2)); System.Console.WriteLine(c1 == c2); System.Console.ReadLine(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUILayout.LabelField("Singletons", boldLabel); for (var i = 0; i < BaseSingleton.allSingletons.Count; ++i) { if (!m_Editors.ContainsKey(i)) { m_Editors.Add(i, null); } if (!m_Foldouts.ContainsKey(i)) { m_Foldouts.Add(i, true); } BaseSingleton singleton = BaseSingleton.allSingletons[i]; m_Foldouts[i] = EditorGUILayout.InspectorTitlebar(m_Foldouts[i], singleton); if (!m_Foldouts[i]) { continue; } UnityEditor.Editor editor = m_Editors[i]; CreateCachedEditor(singleton, null, ref editor); m_Editors[i] = editor; EditorGUI.indentLevel += 1; editor.OnInspectorGUI(); EditorGUILayout.Space(); if (AssetDatabase.Contains(singleton)) { EditorGUILayout.ObjectField( "Reference", singleton, singleton.GetType(), false ); } else { EditorGUILayout.HelpBox("Runtime generated", MessageType.Info); } EditorGUI.indentLevel -= 1; } }
/// <summary> /// Registers a singleton to the global updater. Once registered there will be no need to unregister it since it'll only happen when the application quits. /// </summary> /// <param name="singleton">The Singleton to call Unity functions on</param> /// <param name="deinitialize">The deinitialize method of the singleton. The original method is protected to prevent unintended access.</param> internal static void RegisterSingleton(BaseSingleton singleton, Action deinitialize) { Updater.DestroyEvent += deinitialize; Updater.FixedUpdateEvent += singleton.OnFixedUpdate; Updater.UpdateEvent += singleton.OnUpdate; Updater.LateUpdateEvent += singleton.OnLateUpdate; Updater.ApplicationFocusEvent += singleton.OnApplicationFocus; Updater.ApplicationPauseEvent += singleton.OnApplicationPause; Updater.ApplicationQuitEvent += singleton.OnApplicationQuit; Updater.DrawGizmosEvent += singleton.OnDrawGizmos; Updater.PostRenderEvent += singleton.OnPostRender; Updater.PreCullEvent += singleton.OnPreCull; Updater.PreRenderEvent += singleton.OnPreRender; Updater._singletons.Add(singleton); }
/// <summary> /// Loads A Singleton's Object Data /// </summary> /// <typeparam name="T">The Type Of Object Data</typeparam> /// <param name="bs">The Singleton To Save To</param> /// <param name="filename">The File To Load From</param> private void LoadSingletonObject <T>(BaseSingleton bs, string filename) { if (File.Exists(filename)) { string content = new StreamReader(filename).ReadToEnd(); string[] objs = content.Split('\n'); foreach (string obj in objs) { if (obj.Length > 0) { var b = JsonConvert.DeserializeObject <T>(obj); bs.AddObject(b as BaseInfo); } } } else { bs.InitObjectList(); SaveSingletonObject(bs.AllObjects(), filename); } }
public WizAltBoletimProfViewModel(Falta falta, BaseSingleton baseSingleton) { Falta = falta; Base_ = baseSingleton; Turmas = new ObservableCollection <TurmaFalta>(); var t = new AppFactory().NewTurmaFalta(); t.Turma = falta.Turma; t.Falta.NFaltas = falta.NFaltas; t.Professores = new AppFactory().NewProfessor().Get(2); t.Professor = falta.ProfSubs; t.Falta.NAulasSubs = falta.NAulasSubs; t.Selected = true; Turmas.Add(t); SetProperties(); Base_.HeaderWizard = "Alteração de Falta de Professor"; }
void Awake() { Instance = this; }