internal void ClientLayout_OnClick(object sender, EventArgs eventArgs) { DConsole.WriteLine("ClientLayout_OnClick " + ((VerticalLayout)sender).Id); // TODO: Передача Id конкретной таски BusinessProcess.GlobalVariables[Parameters.IdClientId] = ((VerticalLayout)sender).Id; Navigation.Move("ClientScreen"); }
public override void OnCreate() { DConsole.WriteLine("DB init..."); DBHelper.Init(); DConsole.WriteLine("Settings init..."); Settings.Init(); DConsole.WriteLine("Authorization init..."); Authorization.Init(); if (Authorization.FastAuthorization()) { #if DEBUG DConsole.WriteLine($"Логин и пароль были сохранены." + $"{Environment.NewLine}" + $"Login: {Settings.User} Password: {Settings.Password}{Environment.NewLine}"); #endif DConsole.WriteLine("Loading first screen..."); Navigation.Move(nameof(EventListScreen)); } else { #if DEBUG DConsole.WriteLine($"Логин и пароль НЕ были сохранены." + $"{Environment.NewLine}" + $"Login: {Settings.User} Password: {Settings.Password} {Environment.NewLine}"); #endif DConsole.WriteLine("Loading first screen..."); Navigation.Move(nameof(AuthScreen)); } }
private static string UploadFile(Stream fs) { var req = new HttpRequest("http://api-fotki.yandex.ru"); req.ContentType = "image/jpeg"; req.AddHeader("Authorization", string.Format("OAuth {0}", token)); var result = req.Post(string.Format("/api/users/{0}/photos/", login), fs); if (req.Status != 200) { DConsole.WriteLine(req.Error); return(null); } var doc = new XmlDocument(); doc.LoadXml(result); var nodes = doc.DocumentElement.ChildNodes; foreach (XmlNode node in nodes) { if (node.Name.Equals("link")) { if (node.Attributes["rel"].Value.Equals("self")) { return(node.Attributes["href"].Value); } } } return(null); //smth is going wrong... }
public override void Execute() { while (true) { Sleep(3000); DConsole.WriteLine(DateTime.Now.ToLongTimeString()); DConsole.WriteLine(GPS.CurrentLocation.Latitude.ToString()); DConsole.WriteLine(GPS.CurrentLocation.Longitude.ToString()); } }
public override void OnLoading() { DConsole.WriteLine("SettingsScreen init"); _tabBarComponent = new TabBarComponent(this); Utils.TraceMessage($"Enable Push {Settings.EnablePush}"); }
public void SameSortTest() { PokerGroup PG = new PokerGroup(); // TODO: 初始化为适当的值 PG.Add(new Poker(PokerNum.P10, PokerColor.黑桃)); PG.Add(new Poker(PokerNum.P10, PokerColor.黑桃)); PG.Add(new Poker(PokerNum.P9, PokerColor.红心)); PG.Add(new Poker(PokerNum.P9, PokerColor.黑桃)); PG.Add(new Poker(PokerNum.P9, PokerColor.黑桃)); PG.Add(new Poker(PokerNum.P5, PokerColor.方块)); PG.Add(new Poker(PokerNum.P5, PokerColor.黑桃)); PG.Add(new Poker(PokerNum.P5, PokerColor.红心)); //PG.Add(new Poker(PokerNum.P4, PokerColor.方块)); //PG.Add(new Poker(PokerNum.P4, PokerColor.黑桃)); //PG.Add(new Poker(PokerNum.P4, PokerColor.红心)); //PG.Add(new Poker(PokerNum.P3, PokerColor.方块)); //PG.Add(new Poker(PokerNum.P3, PokerColor.黑桃)); //PG.Add(new Poker(PokerNum.P3, PokerColor.红心)); PokerGroup expected = null; // TODO: 初始化为适当的值 PokerGroup actual; actual = DConsole.SameThreeSort(PG); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
static void start() { DConsole.Print("ScopeName: "); string input = DConsole.ReadLine(); ScopeName = input; cfgSQLConnectionString_InFlow = string.Format(cfgSQLConnectionString_InFlow, ScopeName); DConsole.Print("init? (yes/no)"); string init = DConsole.ReadLine(); if (init.Equals("yes")) { setUpScope(); } else { listCompanyScopes(); } DConsole.Print("clean? (yes/no)"); string clean = DConsole.ReadLine(); if (clean.Equals("yes")) { cleanScope(); } Console.ReadLine(); }
static void cleanScope() { InFlowWFM wfm = new InFlowWFM(cfgWFMBaseAddress, cfgWFMUsername, cfgWFMPassword, cfgSQLConnectionString_InFlow); string input = "..."; do { DConsole.PrintEmptyLines(); DConsole.Print("ProcessName:"); input = Console.ReadLine(); if (input.Length > 0) { DConsole.Print(wfm.deleteProcess(ScopeName, input)); } if (input.Length <= 0) { DConsole.Print(wfm.deleteCompanyScope(ScopeName)); } DConsole.PrintDone(); Console.WriteLine(); } while (input.Length > 0); start(); }
public static void FullSyncAsync(ResultEventHandler <bool> resultEventHandler = null, ResultEventHandler <Database.ProgressArgs> progressCallback = null) { if (_db.SyncIsActive) { #if DEBUG DConsole.WriteLine($"---------------{Environment.NewLine}Синхронизация не запущена," + $" происходит другая синхронизация." + $"{Environment.NewLine}Class {nameof(DBHelper)} method {nameof(FullSyncAsync)}" + $"{Environment.NewLine}---------------"); #endif return; } #if DEBUG DConsole.WriteLine($"---------------{Environment.NewLine}Начинаю полную синхронизацию." + $"{Environment.NewLine}Class {nameof(DBHelper)} method {nameof(FullSyncAsync)}" + $"{Environment.NewLine}---------------"); #endif try { Utils.TraceMessage($"Sync(from Settings) login: {Settings.User} password: {Settings.Password}"); _db.PerformFullSyncAsync(Settings.Server, Settings.User, Settings.Password, Settings.DefaultSyncTimeOut, SyncHandler + resultEventHandler, "Full", progressCallback); if (resultEventHandler == null) { isPartialSyncRequired = false; } } catch (Exception) { SyncHandler("Full", new ResultEventArgs <bool>(false)); } }
public static void FullSync(ResultEventHandler <bool> resultEventHandler = null) { if (_db.SyncIsActive) { #if DEBUG DConsole.WriteLine($"---------------{Environment.NewLine}Синхронизация не запущена," + $" происходит другая синхронизация." + $"{Environment.NewLine}Class {nameof(DBHelper)} method {nameof(FullSync)}" + $"{Environment.NewLine}---------------"); #endif return; } #if DEBUG DConsole.WriteLine($"---------------{Environment.NewLine}Начинаю полную синхронизацию." + $"{Environment.NewLine}Class {nameof(DBHelper)} method {nameof(FullSync)}" + $"{Environment.NewLine}---------------"); #endif try { _db.PerformFullSync(Settings.Server, Settings.User, Settings.Password, Settings.DefaultSyncTimeOut, SyncHandler + resultEventHandler, "Full"); } catch (Exception) { SyncHandler("Full", new ResultEventArgs <bool>(false)); } }
public override void OnCreate() { base.OnCreate(); DConsole.WriteLine("DB init..."); DBHelper.Init(); DConsole.WriteLine("Settings init..."); Settings.Init(); DConsole.WriteLine("Authorization init..."); DynamicScreenRefreshService.Init(); Authorization.Init(); if (Authorization.FastAuthorization() && Settings.UserDetailedInfo != null) { #if DEBUG DConsole.WriteLine($"Логин и пароль были сохранены." + $"{Environment.NewLine}" + $"Login: {Settings.User} Password: {Settings.Password}{Environment.NewLine}"); #endif DConsole.WriteLine("Loading first screen..."); Navigation.Move(nameof(EventListScreen)); } else { #if DEBUG if (Settings.UserDetailedInfo == null) { Utils.TraceMessage("Произошло падение базы... извините"); } DConsole.WriteLine($"Логин и пароль НЕ были сохранены." + $"{Environment.NewLine}" + $"Login: {Settings.User} Password: {Settings.Password} {Environment.NewLine}"); #endif DConsole.WriteLine("Loading first screen..."); Navigation.Move(nameof(AuthScreen)); } }
internal void GoToCOCScreen_OnClick(object sender, EventArgs e) { object eventId; if (!BusinessProcess.GlobalVariables.TryGetValue(Parameters.IdCurrentEventId, out eventId)) { DConsole.WriteLine("Can't find current event ID, going to crash"); } var @event = (Event)DBHelper.LoadEntity(_currentEventRecordset["Id"].ToString()); var status = ((StatusyEvents)@event.Status.GetObject()).Name; var wasStarted = status == EventStatus.InWork || status == EventStatus.Done || status == EventStatus.Close || status == EventStatus.NotDone || status == EventStatus.DoneWithTrouble || status == EventStatus.OnTheApprovalOf; var dictinory = new Dictionary <string, object> { { Parameters.IdCurrentEventId, (string)eventId }, { Parameters.IdIsReadonly, _readonly }, { Parameters.IdWasEventStarted, wasStarted } }; if (CheckAndGoIfNotExsist()) { return; } Navigation.Move(nameof(COCScreen), dictinory); }
public override void OnLoading() { base.OnLoading(); DConsole.WriteLine("Client onloading"); _topInfoComponent = new TopInfoComponent(this) { Header = Translator.Translate("client"), LeftButtonControl = new Image { Source = ResourceManager.GetImage("topheading_back") }, RightButtonControl = new Image { Source = ResourceManager.GetImage("topheading_edit") }, ArrowVisible = false }; _topInfoComponent.ActivateBackButton(); var latitude = Converter.ToDouble(_client["Latitude"]); var longitude = Converter.ToDouble(_client["Longitude"]); if (!latitude.Equals(0.0) && !longitude.Equals(0.0)) { _map = (WebMapGoogle)GetControl("MapClient", true); _map.AddMarker((string)_client["Description"], latitude, longitude, "red"); } _clientDesc = GetConstLenghtString(_client["Description"].ToString()); DConsole.WriteLine("Client end"); }
internal void GetLocation_OnClick(object sender, EventArgs e) { var coordinate = DBHelper.GetCoordinate(TimeRangeCoordinate.DefaultTimeRange); var latitude = Converter.ToDouble(coordinate["Latitude"]); var longitude = Converter.ToDouble(coordinate["Longitude"]); if (!latitude.Equals(0.0) && !longitude.Equals(0.0)) { _clientLatitude = Convert.ToDecimal(latitude); _clientLongitude = Convert.ToDecimal(longitude); #if DEBUG DConsole.WriteLine($"{nameof(_clientLatitude)}:{_clientLatitude} " + $"{Environment.NewLine}" + $"{nameof(_clientLongitude)}:{_clientLongitude}"); #endif var btn = (Button)sender; btn.Text = Translator.Translate("save_coordinates"); btn.OnClick -= GetLocation_OnClick; btn.OnClick += SaveClientLocation_OnClick; } else { ((Button)sender).Text = Translator.Translate("failed_coordinates"); } }
internal void AddContactButton_OnClick(object sender, EventArgs e) { object clientId; if (!BusinessProcess.GlobalVariables.TryGetValue(Parameters.IdClientId, out clientId)) { DConsole.WriteLine("Adding contact error. Can't find current client ID. Unnable to add contact to DB. Going to crash"); return; } var name = ((EditText)Variables["name"]).Text; var position = ((EditText)Variables["position"]).Text; var tel = ((EditText)Variables["tel"]).Text; var email = ((EditText)Variables["email"]).Text; var newContact = new Contacts() { Id = DbRef.CreateInstance("Catalog_Contacts", Guid.NewGuid()), Description = name, Position = position, EMail = tel, Tel = email }; DBHelper.SaveEntity(newContact); var newClientContact = new Client_Contacts() { Ref = DbRef.FromString((string)clientId), Contact = newContact.Id }; DBHelper.SaveEntity(newClientContact); Navigation.Back(true); }
private static Screen GetScreenByControllerName(string name) { //return Screen.CreateScreen("Test." + name); //full type name should be specified //var scr = Screen.CreateScreen("Test." + name); //full type name should be specified Screen scr = (Screen)Application.CreateInstance("Test." + name); //full type name should be specified Stream s = null; var path = string.Format(@"Screen\{0}.xml", name); try { s = Application.GetResourceStream(path); //try to find markup resource } catch { DConsole.WriteLine(string.Format("Resource {0} has not been found", path)); } if (s != null) { scr.LoadFromStream(s); } return(scr); }
// Список internal void CheckListValList_OnClick(object sender, EventArgs e) { if (_readonly) { return; } _currentCheckListItemID = ((VerticalLayout)sender).Id; _textView = (TextView)((VerticalLayout)sender).GetControl(0); var tv = GetTextView(sender); var startObject = "not_choosed"; var items = new Dictionary <object, string> { { "not_choosed", Translator.Translate("not_choosed") } }; var temp = DBHelper.GetActionValuesList(_textView.Id); while (temp.Next()) { if (temp["Val"] == null) { DConsole.WriteLine("Empty value Id: " + (temp["Id"] == null ? "Id is empty" : temp["Id"].ToString())); continue; } items[temp["Id"].ToString()] = temp["Val"].ToString(); if (temp["Val"].ToString() == _textView.Text) { startObject = temp["Id"].ToString(); } } Dialog.Choose(tv.Text, items, startObject, ValListCallback); }
internal void SendData_OnClick(object sender, EventArgs e) { var needMat = new NeedMat { Id = DbRef.CreateInstance("Document_NeedMat", Guid.NewGuid()), Date = DateTime.Now, StatsNeed = StatsNeedNum.GetDbRefFromEnum(StatsNeedNumEnum.New), SR = DbRef.FromString(Settings.UserId), DocIn = DbRef.CreateInstance("Document_Event", Guid.Empty) }; var entitiesList = new ArrayList { needMat }; var line = 1; foreach (Dictionary <string, object> neededMaterial in _data) { var matireals = new NeedMat_Matireals { Id = DbRef.CreateInstance("Document_NeedMat_Matireals", Guid.NewGuid()), LineNumber = line++, SKU = DbRef.FromString((string)neededMaterial["SKU"]), Ref = needMat.Id, Count = (decimal)neededMaterial["Count"] }; entitiesList.Add(matireals); } DBHelper.SaveEntities(entitiesList); _data = null; _isAdd = _isEdit = false; DConsole.WriteLine("Data is saved"); Navigation.Back(); }
private void vl_OnClick(object sender, EventArgs e) { var btn = (Button)sender; DConsole.WriteLine(btn.Text); BusinessProcess.DoBack(); }
internal IEnumerable GetRIM() { DConsole.WriteLine("получение позиций товаров и услуг"); var result = GetDataFromDb(); return(result); }
/* * static string cfgWFMBaseAddress = "https://*****:*****@"Data Source=WIN-60UHMF8LEV6\SQLEXPRESS;Initial Catalog=InFlow-DB;Integrated Security=False;User ID=rpadmin;Password=Riegler2014!;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False"; * * const string SBServerFQDN = "WIN-60UHMF8LEV6"; * const string SBNamespace = "InFlow"; * const string SBUsername = "******"; * const string SBPassword = "******"; * * static string ScopeName = "InFlow"; * * static string workflow_TaskHandler_Path = @"C:\strict\InFlow\TaskTier.xaml"; * static string workflow_MessageHandler_Path = @"C:\strict\InFlow\MessageTier.xaml"; */ static void Main(string[] args) { // System.Net.ServicePointManager.CertificatePolicy = new MyPolicy(); System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; DConsole.Print("DPMS-Azure Management Console\n", ConsoleColor.Yellow); Console.WriteLine(); start(); }
internal void EventListItemHL_OnClick(object sender, EventArgs e) { DConsole.WriteLine("Go To View Event"); var currentEvent = (HorizontalLayout)sender; BusinessProcess.GlobalVariables[Parameters.IdCurrentEventId] = currentEvent.Id; Navigation.Move("EventScreen"); }
void StartTracking_OnClick(object sender, EventArgs e) { if (GPS.StartTracking()) { DConsole.WriteLine("GPS tracking started"); new T().Start(); } }
public override void OnBackground() { base.OnBackground(); var result = GpsTracking.Stop(); #if DEBUG DConsole.WriteLine($"Свернули приложение. GpsTracking is stop: result = {result}"); #endif }
internal void RIMLayout_OnClick(object sender, EventArgs eventArgs) { var rimID = ((HorizontalLayout)sender).Id; if (_isMaterialRequest) { //пришли из экрана заявки на материалы var key = Variables.GetValueOrDefault("returnKey", "newItem"); var dictionary = new Dictionary <string, object> { { "rimId", rimID }, { "priceVisible", false }, { Parameters.IdBehaviour, BehaviourEditServicesOrMaterialsScreen.ReturnValue }, { "returnKey", key }, { Parameters.IdIsService, _isService }, { Parameters.IdIsMaterialsRequest, _isMaterialRequest }, { Parameters.PreviousScreen, Variables } }; DConsole.WriteLine("Go to EditServicesOrMaterials is Material Request true"); Navigation.ModalMove("EditServicesOrMaterialsScreen", dictionary); } else { DConsole.WriteLine("Пытаемся найти номенклатуру в документе " + _currentEventID + " по гуиду " + rimID); var line = DBHelper.GetEventServicesMaterialsLineByRIMID(_currentEventID, rimID); if (line == null) { DConsole.WriteLine("Позиция не найдена, просто добавлеям новую"); var dictionary = new Dictionary <string, object> { { Parameters.IdBehaviour, BehaviourEditServicesOrMaterialsScreen.InsertIntoDB }, { "rimId", rimID }, { Parameters.IdIsService, _isService }, { Parameters.IdIsMaterialsRequest, _isMaterialRequest }, { Parameters.PreviousScreen, Variables } }; Navigation.ModalMove("EditServicesOrMaterialsScreen", dictionary); } else { DConsole.WriteLine("Позиция найдена, открываем окно редактирования количества "); var dictionary = new Dictionary <string, object> { { Parameters.IdBehaviour, BehaviourEditServicesOrMaterialsScreen.UpdateDB }, { Parameters.IdLineId, line.ID }, { Parameters.IdIsService, _isService }, { Parameters.IdIsMaterialsRequest, _isMaterialRequest }, { Parameters.PreviousScreen, Variables } }; Navigation.ModalMove("EditServicesOrMaterialsScreen", dictionary); } } }
internal void EventListItemHL_OnClick(object sender, EventArgs e) { Application.InvokeOnMainThread(() => GpsTracking.Stop()); DConsole.WriteLine("Go To View Event"); var currentEvent = (HorizontalLayout)sender; BusinessProcess.GlobalVariables[Parameters.IdCurrentEventId] = currentEvent.Id; Navigation.Move("EventScreen"); }
static void listCompanyScopes() { InFlowWFM wfm = new InFlowWFM(cfgWFMBaseAddress, cfgWFMUsername, cfgWFMPassword, cfgSQLConnectionString_InFlow); DConsole.PrintList(wfm.listCompanyScopes(), "Company-Scopes:"); Console.WriteLine(); DConsole.PrintList(wfm.listProcessScopes(ScopeName), "Process Scopes of InFlow"); }
private static void Callback(object sender, ResultEventArgs <WebRequest.WebRequestResult> args) { if (args.Result.Success) { #if DEBUG DConsole.WriteLine("Авторизация успешна"); DConsole.WriteLine($"UserId - {Settings.UserId} Web Request Result - {args.Result.Result}"); #endif Utils.TraceMessage($"{nameof(PushNotification)}.{nameof(PushNotification.IsInitialized)} -> {PushNotification.IsInitialized}"); //Проверяем, если пользователь уже сохранен, то делаем частичную синхронизацию, иначе полную. // ReSharper disable once StringCompareIsCultureSpecific.3 if (string.Compare(Settings.User, _webRequest.UserName, true) == 0) { #if DEBUG DConsole.WriteLine($"Авторизировались, пользователь сохранен в системе."); DConsole.WriteLine("Сохраняем пароль"); #endif Settings.Password = _webRequest.Password; #if DEBUG DConsole.WriteLine($"Запустили частичную синхронизацию. From class {nameof(Authorization)}"); #endif DBHelper.SyncAsync(); Utils.TraceMessage($"{nameof(PushNotification)}.{nameof(PushNotification.IsInitialized)} -> {PushNotification.IsInitialized}"); DConsole.WriteLine("Loading first screen..."); Navigation.ModalMove("EventListScreen"); } else { #if DEBUG DConsole.WriteLine($"Авторизировались, пользователь НЕ сохранен в системе."); DConsole.WriteLine("Сохраняем пользователя и пароль в системе"); #endif Settings.User = _webRequest.UserName; Settings.Password = _webRequest.Password; #if DEBUG DConsole.WriteLine($"Запустили полную синхронизацию. From class {nameof(Authorization)}"); #endif Utils.TraceMessage($"{nameof(PushNotification)}.{nameof(PushNotification.IsInitialized)} -> {PushNotification.IsInitialized}"); Application.InvokeOnMainThread(() => AuthScreen.EditableVisualElements(false)); DBHelper.FullSyncAsync(ResultEventHandler); } } else { #if DEBUG DConsole.WriteLine($"Авторизация не удалась. Сбрасываем пароль."); #endif Settings.Password = ""; Application.InvokeOnMainThread(AuthScreen.ClearPassword); ErrorMessageWithToast(args); Application.InvokeOnMainThread(() => AuthScreen.EditableVisualElements(true)); } }
public override void OnLoading() { _isEnable = true; DConsole.WriteLine("AuthScreen init"); _loginEditText = (EditText)GetControl("AuthScreenLoginET", true); _passwordEditText = (EditText)GetControl("AuthScreenPasswordET", true); _enterButton = ((Button)GetControl("ba603e1782d543f696944a603d7f05f2", true)); _indicator = ((Indicator)GetControl("971cb7290f7943ea9bf500e63097b04d", true)); }
public static void TraceMessage(string message = "", [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int sourceLineNumber = 0) { DConsole.WriteLine($"{Environment.NewLine}Message: {message} "); DConsole.WriteLine($"Member Name: {memberName} "); DConsole.WriteLine($"Source file path: {filePath} "); DConsole.WriteLine($"Source line number: {sourceLineNumber} {Environment.NewLine}"); }