private void TaskTimer_Tick(object sender, EventArgs e) { if (_task?.IsCompleted == true || _task?.IsCanceled == true || _task?.IsFaulted == true) { try { TaskTimer.Enabled = false; if (update) { VLog.Log("Спрашиваем про обновление"); AskForm af = new AskForm(); Hide(); if (af.ShowDialog() != DialogResult.Cancel) { ; } { Close(); } } VLog.Log("Запускаем основное приложение"); var appPath = Regex.Replace(Application.ExecutablePath.ToLower(), "(.*).updater.exe$", "$1.exe"); Process.Start(appPath); Close(); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } } }
/// <summary> /// Cycles through guide views for Standard Model Targets with multiple views. /// </summary> public void CycleGuideView() { VLog.Log("cyan", "CycleGuideView() called."); if (this.modelStandard != null) { ModelTarget modelTarget = this.modelStandard.ModelTarget; int activeView = modelTarget.GetActiveGuideViewIndex(); int totalViews = modelTarget.GetNumGuideViews(); if (totalViews > 1 && activeView > -1) { int guideViewIndexToActivate = (activeView + 1) % totalViews; VLog.Log("yellow", modelTarget.Name + ": Activating Guide View Index " + guideViewIndexToActivate.ToString() + " of " + totalViews.ToString() + " total Guide Views."); modelTarget.SetActiveGuideViewIndex(guideViewIndexToActivate); } else { VLog.Log("yellow", "GuideView was not cycled." + "\nActive Guide View Index = " + activeView + "\nNumber of Guide Views = " + totalViews); } } }
public static void ResetObjectTracker() { var objTracker = Vuforia.TrackerManager.Instance.GetTracker <Vuforia.ObjectTracker>(); if (objTracker != null && objTracker.IsActive) { objTracker.Stop(); List <Vuforia.DataSet> activeDataSets = objTracker.GetActiveDataSets().ToList(); foreach (Vuforia.DataSet dataset in activeDataSets) { // The VuforiaEmulator.xml dataset (used by GroundPlane) is managed by Vuforia. if (!dataset.Path.Contains("VuforiaEmulator.xml")) { VLog.Log("white", "Deactivating: " + dataset.Path); objTracker.DeactivateDataSet(dataset); VLog.Log("white", "Activating: " + dataset.Path); objTracker.ActivateDataSet(dataset); } } objTracker.Start(); } }
private void simpleButtonSelect_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.Cancel) { return; } var path = ofd.FileName; try { if (_template == null) { _template = new Template(); } _template.File = File.ReadAllBytes(path); _template.Path = path; _template.User = _user; textEditPath.Text = path; } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
public void ToggleStaticDT(bool enable) { if (StaticDTToggle && deviceObserverSettings) { // we need to disable and re-enable all potentialy tracked targets so that the new device tracker instance // again knows about those tracked targets (information is propagated upon target activate) var targets = FindObjectsOfType <ScalableDataSetTrackableBehaviour>() .Where(m => m.enabled) .ToList(); foreach (var target in targets) { target.enabled = false; } if (!deviceObserverSettings.ToggleStaticDeviceTracker(enable)) { VLog.Log("red", "Unable to set the Device Tracker Static to " + enable); } foreach (var target in targets) { target.enabled = true; } } }
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs args) { var message = args.Exception.ToString(); VLog.Log(message); MessageBox.Show(message); }
private void panelControl2_Click(object sender, EventArgs e) { var id = int.Parse(((PanelControl)sender).Tag.ToString()); var date = _date.AddDays(id - 1).AddHours(10); AddOrderForm aof = new AddOrderForm(_user, date, _car); if (aof.ShowDialog() == DialogResult.Cancel) { return; } //_form.LoadCarGraph(); _car = Model.Cars.Read(_car.Id); if (_date.Day == 0) { ShowMonth(_date.Month, _date.Year); } else { var dates = _date.AddDays(1); ShowMonth(dates.Month, dates.Year, dates.Day); } try { var order = aof.GetOrder; _form.PostOrder(order); _form.PostBron(order.DateFrom, order.DateTo, order.SiteId); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
public void SwitchMode(bool toAR) { VLog.Log("cyan", "SwitchMode() called: " + (toAR ? "toAR" : "toVR")); this.InAR = toAR; this.fader.FadeOut(); }
void IFaderNotify.OnFadeOutFinished() { VLog.Log("cyan", "IFaderNotify.OnFadeOutFinished() called: " + gameObject.name); // When fade-out is finished, we reset the focused state and update materials. this.Focused = false; SetFocusedMaterial(false); }
void IFaderNotify.OnFadeInFinished() { VLog.Log("cyan", "IFaderNotify.OnFadeInFinished() called: " + gameObject.name); // When fade-in is finished, we then reset triggered state and focused time. this.triggered = false; this.focusedTime = 0; }
private void Save() { try { foreach (Control ctrl in panelControlServices.Controls) { if (!(ctrl is ServicesControl)) { continue; } var sc = (ServicesControl)ctrl; var serv = sc.GetService(); Model.Services.Put(serv); } if (_template != null) { if (_template.Id == 0) { Model.Templates.Post(_template); } else { Model.Templates.Put(_template); } } var rName = textEditRName.Text.Trim(); var rAddress = textEditRAddress.Text.Trim(); var rPhones = textEditRPhones.Text.Trim(); var rTime = textEditRTime.Text.Trim(); if (_prokat == null) { var prokat = new Prokat { Name = rName, Address = rAddress, Phones = rPhones, Worktime = rTime, User = _user }; Model.Prokats.Post(prokat); } else { _prokat.Name = rName; _prokat.Address = rAddress; _prokat.Phones = rPhones; _prokat.Worktime = rTime; Model.Prokats.Put(_prokat); } Close(); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
public UpdaterForm() { _task = new Task(() => { update = false; try { VLog.Log("Шлём запрос на проверку версии"); var url = new Uri("http://" + _serverUrl + "/api/crm/version"); var cookies = new CookieContainer(); var request = HttpWebRequest.Create(url) as HttpWebRequest; request.CookieContainer = cookies; request.ServicePoint.Expect100Continue = false; request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"; request.PreAuthenticate = true; StreamReader objReader = new StreamReader(request.GetResponse().GetResponseStream()); var response = objReader.ReadToEnd(); var decoded = HttpUtility.HtmlDecode(Regex.Unescape(response)); var siteversion = decoded.Split(':')[1].Split('"')[1]; //{"version":"1.00.000.000"} VLog.Log("Получили версию: " + siteversion); if (Version != siteversion) { try { var ver = Version.Split('.'); var dec = siteversion.Split('.'); for (int i = 0; i < ver.Count(); i++) { var ver1 = int.Parse(ver[i]); var dec1 = int.Parse(dec[i]); if (ver1 < dec1) { update = true; break; } } } catch (Exception ex) { VLog.Log(ex); //MessageBox.Show(ex.Message); } } } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }); _task.Start(); InitializeComponent(); }
public void LogAllDataSets() { List <DataSet> allDataSets = this.objectTracker.GetDataSets().ToList(); foreach (DataSet ds in allDataSets) { VLog.Log("cyan", "DS: " + ds.Path); } }
private void Bc_Click(object sender, EventArgs e) { var id = (int)((Control)sender).Tag; Order order = null; try { order = Model.Orders.Read(id); } catch (Exception ex) { VLog.Log(ex); } if (order == null) { ((Control)sender).Dispose(); return; } var oldfrom = order.DateFrom; var oldto = order.DateTo; AddOrderForm adf = new AddOrderForm(_user, order); if (adf.ShowDialog() == DialogResult.Cancel) { return; } _car = Model.Cars.Read(_car.Id); if (_date.Day == 0) { ShowMonth(_date.Month, _date.Year); } else { var dates = _date.AddDays(1); ShowMonth(dates.Month, dates.Year, dates.Day); } try { order = adf.GetOrder; if (adf.DeleteOrder) { _form.DeleteOrder(order); return; } _form.PostOrder(order); if (order.DateFrom != oldfrom || order.DateTo != oldto) { _form.PostBron(order.DateFrom, order.DateTo, order.SiteId); } } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
/// <summary> /// This method will be called whenever a new VuMark is detected /// </summary> public void OnVuMarkDetected(VuMarkTarget vumarkTarget) { VLog.Log("cyan", "VuMarkHandler.OnVuMarkDetected(): " + GetVuMarkId(vumarkTarget)); // Check if this VuMark's ID already has a stored texture. Generate and store one if not. if (RetrieveStoredTextureForVuMarkTarget(vumarkTarget) == null) { this.vumarkInstanceTextures.Add(GetVuMarkId(vumarkTarget), GenerateTextureFromVuMarkInstanceImage(vumarkTarget)); } }
public void OnVuMarkTargetAssigned() { if (this.mTrackableBehaviour is VuMarkBehaviour) { this.vumarkBehaviour = this.mTrackableBehaviour as VuMarkBehaviour; if (this.vumarkBehaviour.VuMarkTarget != null) { VLog.Log("cyan", "VuMark ID Tracked: " + this.vumarkBehaviour.VuMarkTarget.InstanceId.NumericValue); } } }
IEnumerator OnVuMarkTargetAvailable(VuMarkBehaviour vumarkBehaviour) { // We need to wait until VuMarkTarget is available yield return(new WaitUntil(() => vumarkBehaviour.VuMarkTarget != null)); VLog.Log("cyan", "VuMarkHandler.OnVuMarkTargetAvailable() called: " + GetVuMarkId(vumarkBehaviour.VuMarkTarget)); SetVuMarkInfoForCanvas(vumarkBehaviour); SetVuMarkAugmentation(vumarkBehaviour); SetVuMarkOpticalSeeThroughConfig(vumarkBehaviour); }
private void buttonLogin_Click(object sender, EventArgs e) { try { Login(); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
public void AddAdvancedModelTargetBehaviour(ModelTargetBehaviour mtb) { Debug.Log("AddAdvancedModelTargetBehaviour() called."); if (mtb != null && this.modelTargetBehaviours != null) { this.modelTargetBehaviours.Add(mtb); } VLog.Log("cyan", "# of Advanced MTBs: " + this.modelTargetBehaviours.Count); EnableSymbolicTargetsUI(this.modelTargetBehaviours.Count == 0); }
public static void Init() { if (!_initialized) { VLog.Log("Инициализируем модель"); VLog.Log("строка подключения:" + ConnectionString); XpoDefault.DataLayer = ConnectionHelper.GetDataLayer(AutoCreateOption.DatabaseAndSchema); _initialized = true; VLog.Log("Добавляем админа"); InitTables(); VLog.Log("Модель готова"); } }
public AskOrderForm(Order order) { InitializeComponent(); try { labelControlCar.Text = string.Format("Автомобиль: {0}", order.Car); labelControlClient.Text = string.Format("Клиент: {0}", order.Client); labelControlFrom.Text = string.Format("Дата начала аренды: {0}", order.DateFrom); labelControlTo.Text = string.Format("Дата окончания аренды: {0}", order.DateTo); } catch (Exception ex) { VLog.Log(ex); } }
IEnumerator TriggerFade(float duration, bool isFadeOut) { VLog.Log("yellow", "Queueing Fade " + (isFadeOut ? "Out" : "In")); yield return(new WaitUntil(() => !this.IsFadingInProgress)); if (!this.IsFadingInProgress) { VLog.Log("yellow", "Starting Fade " + (isFadeOut ? "Out" : "In")); this.fadeStartTime = Time.time; this.fadeOut = isFadeOut; this.fadeDuration = duration; this.IsFadingInProgress = true; } }
void IFaderNotify.OnFadeOutFinished() { VLog.Log("cyan", "IFaderNotify.OnFadeOutFinished() called: " + gameObject.name); // We need to check if the video background is curently enabled // because Vuforia may restart the video background when the App is resumed // even if the app was paused in VR mode MixedRealityController.Mode mixedRealityMode = GetMixedRealityMode(); if ((this.currentMode != mixedRealityMode) || (this.InAR != VideoBackgroundManager.Instance.VideoBackgroundEnabled)) { // mixed reality mode to switch to this.currentMode = mixedRealityMode; // When we transition to VR, we deactivate the Datasets // before setting the mixed reality mode. // so to reduce CPU usage, as tracking is not needed in this phase // (with AutoStopCameraIfNotRequired ON by default, camera/tracker // will be turned off for performance optimization). if (this.currentMode == MixedRealityController.Mode.HANDHELD_VR || this.currentMode == MixedRealityController.Mode.VIEWER_VR) { Debug.Log("Switching to VR: deactivating datasets"); ActivateDataSets(false); } // As we are moving back to AR, we re-activate the Datasets, // before setting the mixed reality mode. // this will ensure that the Tracker and Camera are restarted, // in case they were previously stopped when moving to VR // before activating the AR mode if (this.currentMode == MixedRealityController.Mode.HANDHELD_AR || this.currentMode == MixedRealityController.Mode.VIEWER_AR) { Debug.Log("Switching to AR: activating datasets"); ActivateDataSets(true); } MixedRealityController.Instance.SetMode(this.currentMode); this.vrContentManager.EnableVRContent(!this.InAR); this.fader.FadeIn(); } }
private void simpleButtonChangePassword_Click(object sender, EventArgs e) { try { var pass1 = textEditPassword1.Text.Trim(); var pass2 = textEditPassword2.Text.Trim(); var oldpass = textEditOldPassword.Text.Trim(); if (string.IsNullOrEmpty(pass1) || string.IsNullOrEmpty(oldpass) || string.IsNullOrEmpty(pass2)) { MessageBox.Show("Пароль не может быть пустым"); return; } var oldpassHash = MD5Hash.Get(oldpass, Encoding.Default); if (_user.PasswordHash != oldpassHash) { MessageBox.Show("Старый пароль не совпадает с введенным"); return; } if (!pass1.Equals(pass2)) { MessageBox.Show("Новые пароли не совпадают"); return; } string url = string.Format("https://" + _mf._serverUrl + "/api/company/update_password?password={0}", pass1); VLog.Log("Постим пароль."); var result = _mf.PostString(url); VLog.Log("Запостили пароль: " + result); if (result.ToLower() != "true") { throw new Exception("Ошибка во время создания пароля."); } _user.PasswordHash = MD5Hash.Get(pass1, Encoding.Default); _user.Password = pass1; Model.Users.Put(_user, true); textEditPassword1.Text = ""; textEditPassword2.Text = ""; textEditOldPassword.Text = ""; MessageBox.Show("Пароль изменен."); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }
private void simpleButtonUpdate_Click(object sender, EventArgs e) { _task = new Task(() => { var appPath = Path.Combine(Path.GetTempPath(), Application.ProductName); try { Directory.CreateDirectory(appPath); appPath = Path.Combine(appPath, "Setup.exe"); VLog.Log("Скачиваем файл обновления"); var url = new Uri("http://" + _serverUrl + "/api/crm/download"); var cookies = new CookieContainer(); var request = HttpWebRequest.Create(url) as HttpWebRequest; request.CookieContainer = cookies; request.ServicePoint.Expect100Continue = false; request.Method = "GET"; request.ContentType = "application/x-www-form-urlencoded"; request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"; request.PreAuthenticate = true; var resp = request.GetResponse(); using (var fileStream = File.Create(appPath)) { resp.GetResponseStream().CopyTo(fileStream); } } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); return; } try { VLog.Log("Запускаем установщик обновления"); Process.Start(appPath); } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(ex.Message); } }); _task.Start(); }
void DeactivateActiveDataSets(bool destroyDataSets = false) { List <DataSet> activeDataSets = this.objectTracker.GetActiveDataSets().ToList(); foreach (DataSet ds in activeDataSets) { // The VuforiaEmulator.xml dataset (used by GroundPlane) is managed by Vuforia. if (!ds.Path.Contains("VuforiaEmulator.xml")) { VLog.Log("white", "Deactivating: " + ds.Path); this.objectTracker.DeactivateDataSet(ds); if (destroyDataSets) { this.objectTracker.DestroyDataSet(ds, false); } } } }
void Update() { if (!this.isModelTargetReferenceStored && this.mTrackableBehaviour.Trackable != null) { VLog.Log("yellow", "Storing reference to " + this.mTrackableBehaviour.TrackableName + ": " + this.mTrackableBehaviour.CurrentStatus + " -- " + this.mTrackableBehaviour.CurrentStatusInfo); ModelTargetBehaviour mtb = this.mTrackableBehaviour as ModelTargetBehaviour; if (mtb != null && this.modelTargetsManager) { this.modelTargetsManager.AddAdvancedModelTargetBehaviour(mtb); this.isModelTargetReferenceStored = true; } } }
/// <summary> /// Register a callback which is invoked whenever a VuMark-result is newly detected which was not tracked in the frame before /// </summary> /// <param name="vumarkBehaviour"></param> public void OnVuMarkBehaviourDetected(VuMarkBehaviour vumarkBehaviour) { VLog.Log("cyan", "VuMarkHandler.OnVuMarkBehaviourDetected(): " + vumarkBehaviour.TrackableName); // The GameObject with the VuMarkBehaviour component attached gets duplicated whenever // a new VuMark is detected and the augmentations get attached to the new object. // Since this GameObject contains a Canvas, we need to reset the Camera reference when // duplicating, otherwise the MRTK will throw an exception. The MRTK then assigns the // appropriate Camera reference to the Canvas. vumarkBehaviour.GetComponentInChildren <Canvas>().worldCamera = null; GenerateVuMarkBorderOutline(vumarkBehaviour); ToggleRenderers(vumarkBehaviour.gameObject, true); // Check for existance of previous augmentations and delete before instantiating new ones. DestroyChildAugmentationsOfTransform(vumarkBehaviour.transform); StartCoroutine(OnVuMarkTargetAvailable(vumarkBehaviour)); }
void LoadDataSet(string datasetName) { if (DataSet.Exists(datasetName)) { DataSet dataset = this.objectTracker.CreateDataSet(); if (dataset.Load(datasetName)) { VLog.Log("yellow", "Loaded DataSet: " + datasetName); } else { Debug.LogError("Failed to load DataSet: " + datasetName); } } else { VLog.Log("yellow", "The following DataSet not found in 'StreamingAssets/Vuforia': " + datasetName); } }
private void simpleButton2_Click(object sender, EventArgs e) { try { var login = textBox1.Text.Trim(); var pass = textBox2.Text.Trim(); var user = new User() { PasswordHash = MD5Hash.Get(pass, Encoding.Default), Login = login, }; Model.Users.Post(user); DialogResult = DialogResult.OK; } catch (Exception ex) { VLog.Log(ex); MessageBox.Show(Resources.UserForm_simpleButton2_Click_Ошибка_во_время_создания_пользователя_); } }