public WindowViewModel() { state = State.AudioSelecting; ViewHome = false; ViewBack = false; algorithmPage = null; navigationLine = NavigationCodes.Start; startPage = new Pages.MainPage(); CurrentPage = startPage; ((ISupportParameter)CurrentPage.DataContext).Parameter = (Action <InterViewModelPackage>)Navigate; }
public CodingViewModel(NavigationCodes code, IHidingMethod hidingMethod, DigitalAudio audio) { Message = ""; cover = audio; method = hidingMethod; conteinerCapacity = hidingMethod.GetAvailableSpace(audio); action = code; switch (code) { case NavigationCodes.Extract: CodingAction = "Extract"; break; case NavigationCodes.Embed: CodingAction = "Embed"; break; default: CodingAction = "Undefined"; break; } }
public MethodViewModel(NavigationCodes navigationCodes) { SelectedMethod = null; HidingMethods = new List <IHidingMethod>(4); HidingMethods.Add(new LSBMethod()); HidingMethods.Add(new PhaseCoding()); HidingMethods.Add(new SpreadSpectrum()); HidingMethods.Add(new ParityCoding()); var attrType = typeof(HidingMethodParamAttribute); methodsParamsDict = new Dictionary <string, MethodConstrProp[]>(HidingMethods.Count); if (navigationCodes == NavigationCodes.Embed) { foreach (var method in HidingMethods) { var props_types = method.GetType().GetProperties(); var props = (from prop in props_types where Attribute.IsDefined(prop, attrType) where !((HidingMethodParamAttribute)prop.GetCustomAttribute(attrType)).NotInEmbed select new MethodConstrProp(method, prop)).ToArray(); methodsParamsDict.Add(method.ToString(), props); } } else { foreach (var method in HidingMethods) { var props_types = method.GetType().GetProperties(); var props = (from prop in props_types where Attribute.IsDefined(prop, typeof(HidingMethodParamAttribute)) where !((HidingMethodParamAttribute)prop.GetCustomAttribute(attrType)).NotInExtract select new MethodConstrProp(method, prop)).ToArray(); methodsParamsDict.Add(method.ToString(), props); } } }
public void Navigate(InterViewModelPackage package) { if (package.Code == NavigationCodes.Start) { GoHome(); } else { ViewHome = true; switch (state) { case State.AudioSelecting: state = State.AlgorithmSelecting; Audio = package.Data as DigitalAudio; navigationLine = package.Code; CurrentPage = GetAlgorithmPage(); break; case State.AlgorithmSelecting: state = State.MessageCoding; ViewBack = true; hidingMethod = package.Data as IHidingMethod; CurrentPage = new Pages.CodingPage { DataContext = new CodingViewModel(navigationLine, hidingMethod, Audio) }; ((ISupportParameter)CurrentPage.DataContext).Parameter = (Action <InterViewModelPackage>)Navigate; break; case State.MessageCoding: break; default: break; } } }
public InterViewModelPackage(NavigationCodes code, object data) { Code = code; Data = data; }