コード例 #1
0
        /// <summary>
        /// Retrieve the results of a background export
        /// Example: Retrieve Background Export 231243
        /// </summary>
        /// <param name="objectIdString">Id of BackgroundExport UserObject containing serialized ResultsFormat</param>
        /// <returns></returns>

        public static string RetrieveBackgroundExport(
            string objectIdString)
        {
            ResultsFormat rf;
            Query         q;
            int           objId;

            QbUtil.SetMode(QueryMode.Build);             // be sure in build mode

            if (!int.TryParse(objectIdString, out objId))
            {
                return("Invalid UserObjectId: " + objectIdString);
            }

            UserObject uo = UserObjectDao.Read(objId);

            if (uo == null)
            {
                return("RunInBackground UserObject not found: " + objectIdString);
            }
            if (uo.Type != UserObjectType.BackgroundExport)
            {
                return("Object is not the expected RunInBackground UserObject type");
            }

            rf = ResultsFormat.Deserialize(uo.Content);
            if (rf == null)
            {
                throw new Exception("Failed to deserialize ResultsFormat: " + objectIdString);
            }

            string clientFile = rf.OutputFileName;
            string serverFile = GetServerFileName(rf, objId);

            string ext    = Path.GetExtension(clientFile);
            string filter = "*" + ext + "|*" + ext;

            if (SharePointUtil.IsRegularFileSystemName(clientFile))
            {
                clientFile = UIMisc.GetSaveAsFilename("Retrieve Background Export File", clientFile, filter, ext);
            }

            else
            {
                clientFile =
                    SharePointFileDialog.GetSaveAsFilename("Retrieve Background Export File", clientFile, filter, ext);
            }

            if (String.IsNullOrEmpty(clientFile))
            {
                return("");
            }

            Progress.Show("Retrieving file...");
            try { ServerFile.CopyToClient(serverFile, clientFile); }
            catch (Exception ex)
            {
                string msg =
                    "Unable to retrieve cached export file: " + serverFile + "\n" +
                    "to client file: " + clientFile + "\n" +
                    DebugLog.FormatExceptionMessage(ex);
                ServicesLog.Message(msg);
                Progress.Hide();
                return(msg);
            }

            Progress.Hide();

            if (Lex.Eq(ext, ".xls") || Lex.Eq(ext, ".xlsx") || Lex.Eq(ext, ".doc") || Lex.Eq(ext, ".docx"))
            {
                DialogResult dr = MessageBoxMx.Show("Do you want to open " + clientFile + "?",
                                                    UmlautMobius.String, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    SystemUtil.StartProcess(clientFile);
                }
            }

            return("Background export file retrieved: " + clientFile);
        }
コード例 #2
0
        internal static int OpenFile(Form1 form, int tabIdentity, String[] specificFileNames, bool showMessages, bool saveNewRecentFile, out List <String> errors)
        {
            CustomXtraTabControl pagesTabControl      = form.pagesTabControl;
            ToolStripStatusLabel toolStripStatusLabel = form.toolStripStatusLabel;
            ToolStripProgressBar toolStripProgressBar = form.toolStripProgressBar;
            OpenFileDialog       openFileDialog       = form.openFileDialog;

            bool isWindowsHostsFile = false;
            int  localTabIdentity   = tabIdentity;

            errors = new List <String>();

            openFileDialog.InitialDirectory = FileUtil.GetInitialFolder(form);
            openFileDialog.Multiselect      = true;
            SetFileDialogFilter(openFileDialog);

            TrayManager.RestoreFormIfIsInTray(form);

            try
            {
                String[] fileNames;

                if (specificFileNames == null || specificFileNames.Length <= 0)
                {
                    if (openFileDialog.ShowDialog() != DialogResult.OK)
                    {
                        return(tabIdentity);
                    }

                    fileNames = openFileDialog.FileNames;
                }
                else
                {
                    fileNames = specificFileNames;
                }

                //Verify if file is a DtPad session
                if (fileNames.Length == 1 && fileNames[0].EndsWith(".dps"))
                {
                    SessionManager.OpenSession(form, fileNames[0]);
                    return(form.TabIdentity);
                }

                Application.DoEvents();
                toolStripProgressBar.Value = 0;

                foreach (String fileName in fileNames)
                {
                    //Verify if file is Windows hosts file
                    if (fileName.Contains(@"drivers\etc\hosts"))
                    {
                        if (!SystemUtil.IsUserAdministrator())
                        {
                            WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("UserNotAdmin", className));
                        }

                        isWindowsHostsFile = true;
                    }

                    if (!showMessages)
                    {
                        if (!File.Exists(fileName))
                        {
                            errors.Add(String.Format(LanguageUtil.GetCurrentLanguageString("NoMessageFileNotExists", className), fileName));
                            continue;
                        }
                        if (FileUtil.IsFileInUse(fileName))
                        {
                            errors.Add(String.Format(LanguageUtil.GetCurrentLanguageString("NoMessageFileInUse", className), fileName));
                            continue;
                        }
                        if (FileUtil.IsFileTooLargeForDtPad(fileName))
                        {
                            errors.Add(String.Format(LanguageUtil.GetCurrentLanguageString("NoMessageFileTooHeavy", className), fileName));
                            continue;
                        }
                    }
                    else if (!File.Exists(fileName))
                    {
                        WindowManager.ShowAlertBox(form, String.Format(LanguageUtil.GetCurrentLanguageString("FileNotExisting", className), fileName));
                        continue;
                    }
                    else if (FileUtil.IsFileInUse(fileName))
                    {
                        WindowManager.ShowAlertBox(form, String.Format(LanguageUtil.GetCurrentLanguageString("FileInUse", className), fileName));
                        continue;
                    }
                    if (FileUtil.IsFileTooLargeForDtPad(fileName))
                    {
                        WindowManager.ShowAlertBox(form, String.Format(LanguageUtil.GetCurrentLanguageString("FileTooHeavy", className), fileName));
                        continue;
                    }

                    //Cycle and check if the file is already open, in which case I select its tab and continue with the next one
                    XtraTabPage tabPage;
                    if (FileUtil.IsFileAlreadyOpen(form, fileName, out tabPage))
                    {
                        pagesTabControl.SelectedTabPage = tabPage;
                        toolStripProgressBar.PerformStep();
                        toolStripProgressBar.PerformStep();
                        toolStripProgressBar.PerformStep();
                        toolStripProgressBar.PerformStep();
                        toolStripProgressBar.Visible = false;
                        continue;
                    }

                    //Verify if file is an archive
                    try
                    {
                        ZipFile file = null;
                        bool    isZipFile;

                        try
                        {
                            file      = new ZipFile(fileName);
                            isZipFile = file.TestArchive(false, TestStrategy.FindFirstError, form.Zip_Errors);
                        }
                        finally
                        {
                            if (file != null)
                            {
                                file.Close();
                            }
                        }

                        if (isZipFile)
                        {
                            WindowManager.ShowZipExtract(form, fileName);
                            continue;
                        }
                    }
                    catch (ZipException)
                    {
                    }

                    toolStripProgressBar.Visible = true;
                    toolStripProgressBar.PerformStep();

                    String   fileContents;
                    Encoding fileEncoding;
                    bool     anonymousFile = false;

                    //Verify if file is a PDF
                    if (fileName.EndsWith(".pdf"))
                    {
                        bool success;
                        fileContents = PdfUtil.ExtractText(fileName, out success);

                        if (!success)
                        {
                            WindowManager.ShowAlertBox(form, LanguageUtil.GetCurrentLanguageString("InvalidPdf", className));
                            return(tabIdentity);
                        }

                        fileEncoding  = EncodingUtil.GetDefaultEncoding();
                        anonymousFile = true;
                    }
                    else
                    {
                        fileContents = FileUtil.ReadToEndWithEncoding(fileName, out fileEncoding);
                    }

                    bool favouriteFile = FavouriteManager.IsFileFavourite(fileName);
                    if (!favouriteFile && saveNewRecentFile)
                    {
                        ConfigUtil.UpdateParameter("LastUserFolder", Path.GetDirectoryName(fileName));
                        FileListManager.SetNewRecentFile(form, fileName);
                    }
                    toolStripProgressBar.PerformStep();

                    CustomRichTextBox pageTextBox = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage);
                    if (!String.IsNullOrEmpty(pageTextBox.Text) || !String.IsNullOrEmpty(ProgramUtil.GetFilenameTabPage(pagesTabControl.SelectedTabPage)))
                    {
                        localTabIdentity = TabManager.AddNewPage(form, localTabIdentity);
                    }
                    toolStripProgressBar.PerformStep();

                    //Row number check
                    WindowManager.CheckLineNumbersForTextLenght(form, fileContents);

                    FileInfo fileInfo = new FileInfo(fileName);

                    pageTextBox = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage);

                    //Verify if file is a tweet file
                    if (fileName.EndsWith(".tweet") && !ColumnRulerManager.IsPanelOpen(form))
                    {
                        ColumnRulerManager.TogglePanel(form);
                    }

                    pageTextBox.Text           = fileContents.Replace(Environment.NewLine, ConstantUtil.newLine);
                    pageTextBox.CustomOriginal = ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage).Text.GetHashCode().ToString();
                    pageTextBox.CustomEncoding = fileEncoding.CodePage.ToString();

                    if (!anonymousFile)
                    {
                        String fileNameWithoutPath = Path.GetFileName(fileName);

                        pageTextBox.CustomModified = false;
                        ProgramUtil.SetFilenameTabPage(pagesTabControl.SelectedTabPage, fileName);
                        pagesTabControl.SelectedTabPage.ImageIndex   = fileInfo.IsReadOnly ? 2 : 0;
                        pagesTabControl.SelectedTabPage.Text         = fileNameWithoutPath;
                        pagesTabControl.SelectedTabPage.Tooltip      = fileName;
                        pagesTabControl.SelectedTabPage.TooltipTitle = fileNameWithoutPath;
                        form.Text = String.Format("DtPad - {0}", fileNameWithoutPath);
                        TabManager.ToggleTabFileTools(form, true);
                    }
                    else
                    {
                        pageTextBox.CustomModified = true;
                    }

                    toolStripStatusLabel.Text = String.Format("{0} \"{1}\" {2}", LanguageUtil.GetCurrentLanguageString("File", className), Path.GetFileName(fileName), LanguageUtil.GetCurrentLanguageString("Opened", className));
                    toolStripProgressBar.PerformStep();

                    tabIdentity = localTabIdentity;

                    if (!String.IsNullOrEmpty(fileInfo.Extension) && ConfigUtil.GetStringParameter("AutoFormatFiles").Contains(fileInfo.Extension))
                    {
                        FormatManager.FormatXml(form);
                    }

                    if (ConfigUtil.GetBoolParameter("AutoOpenHostsConfigurator") && isWindowsHostsFile)
                    {
                        pagesTabControl.SelectedTabPage.Appearance.Header.ForeColor = ConfigUtil.GetColorParameter("ColorHostsConfigurator");
                        CustomFilesManager.OpenHostsSectionPanel(form);
                        isWindowsHostsFile = false;
                    }
                }
            }
            catch (Exception exception)
            {
                TabManager.ToggleTabFileTools(form, false);

                toolStripProgressBar.Visible = false;
                toolStripProgressBar.Value   = 0;

                if (showMessages)
                {
                    WindowManager.ShowErrorBox(form, exception.Message, exception);
                }
            }
            finally
            {
                toolStripProgressBar.Visible = false;
                toolStripProgressBar.Value   = 0;
            }

            return(tabIdentity);
        }
コード例 #3
0
        private string HandleException(Exception exception, Requester requester)
        {
            string id = null;

            try
            {
                if (ErrorOnCapture != null)
                {
                    ErrorOnCapture(exception);
                    return(null);
                }

                if (exception != null)
                {
                    SystemUtil.WriteError(exception);
                }

                if (requester != null)
                {
                    if (requester.Data != null)
                    {
                        SystemUtil.WriteError("Request body (raw):", requester.Data.Raw);
                        SystemUtil.WriteError("Request body (scrubbed):", requester.Data.Scrubbed);
                    }

                    if (requester.WebRequest != null && requester.WebRequest.Headers != null && requester.WebRequest.Headers.Count > 0)
                    {
                        SystemUtil.WriteError("Request headers:", requester.WebRequest.Headers.ToString());
                    }
                }

                var webException = exception as WebException;
                if (webException == null || webException.Response == null)
                {
                    return(null);
                }

                var response = webException.Response;
                id = response.Headers["X-Sentry-ID"];
                if (SystemUtil.IsNullOrWhiteSpace(id))
                {
                    id = null;
                }

                string messageBody;
                using (var stream = response.GetResponseStream())
                {
                    if (stream == null)
                    {
                        return(id);
                    }

                    using (var sw = new StreamReader(stream))
                    {
                        messageBody = sw.ReadToEnd();
                    }
                }

                SystemUtil.WriteError("Response headers:", response.Headers.ToString());
                SystemUtil.WriteError("Response body:", messageBody);
            }
            catch (Exception onErrorException)
            {
                SystemUtil.WriteError(onErrorException.ToString());
            }

            return(id);
        }
コード例 #4
0
        private async Task SetupScreen(TargetDevice target)
        {
            this.target    = target;
            ScreenViewData = new LiveviewScreenViewData(target);
            ScreenViewData.PropertyChanged += ScreenViewData_PropertyChanged;
            LiveviewContext        = new LiveviewContext(target, HistogramCreator);
            LiveviewUnit.Context   = LiveviewContext;
            LayoutRoot.DataContext = ScreenViewData;

            try
            {
                await SequentialOperation.SetUp(target, liveview);
            }
            catch (Exception ex)
            {
                DebugUtil.Log(() => "Failed setup: " + ex.Message);
                var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    AppShell.Current.Toast.PushToast(new ToastContent {
                        Text = SystemUtil.GetStringResource("ErrorMessage_CameraSetupFailure")
                    });
                    AppShell.Current.AppFrame.GoBack();
                });
                return;
            }

            ScreenViewData.ConnectionEstablished = true;

            target.Status.PropertyChanged    += Status_PropertyChanged;
            target.Api.AvailiableApisUpdated += Api_AvailiableApisUpdated;

            liveview.JpegRetrieved       += liveview_JpegRetrieved;
            liveview.FocusFrameRetrieved += Liveview_FocusFrameRetrieved;
            liveview.Closed += liveview_Closed;
            LiveviewUnit.FpsTimer.Start();

            BatteryStatusDisplay.BatteryInfo = target.Status.BatteryInfo;
            var panels = SettingPanelBuilder.CreateNew(target);
            var pn     = panels.GetPanelsToShow();

            foreach (var panel in pn)
            {
                ControlPanel.Children.Add(panel);
            }

            ControlPanel.Children.Add(robot.Gui);

            setShootModeEnabled = target.Api.Capability.IsAvailable(API_SET_SHOOT_MODE);
            ControlPanel.SetChildrenControlHitTest(!target.Status.IsRecording());
            ControlPanel.SetChildrenControlTabStop(!target.Status.IsRecording());

            _CommandBarManager.ShootingScreenBarData = ScreenViewData;
            _CommandBarManager.ApplyShootingScreenCommands(AppBarUnit);

            LiveviewUnit.FramingGuideDataContext = ApplicationSettings.GetInstance();
            UpdateShutterButton(target.Status);

            OnCameraStatusChanged(target.Status);

            LiveviewUnit.SetupFocusFrame(ApplicationSettings.GetInstance().RequestFocusFrameInfo).IgnoreExceptions();

            SetUIHandlers();

            if (target.Status.ShootMode?.Current == ShootModeParam.Audio)
            {
                liveviewDisabledByAudioMode = true;
            }
        }
コード例 #5
0
ファイル: CopyForm.cs プロジェクト: kdascatoyeung/KDASMyCloud
        private void btnSave_Click(object sender, EventArgs e)
        {
            string directory = @"\\kdthk-dm1\project\KDTHK-DM\" + AdUtil.getAccount("kmhk.local");

            List <string> queryList = new List <string>();

            foreach (DataGridViewRow row in dgvCopySetup.Rows)
            {
                string fileName     = row.Cells[1].Value.ToString();
                string keyword      = row.Cells[2].Value.ToString();
                string favSelection = row.Cells[3].Value.ToString();
                string filePath     = row.Cells[4].Value.ToString();
                string folder       = row.Cells[6].Value.ToString();
                string shared       = row.Cells[7].Value.ToString();
                string extension    = Path.GetExtension(filePath);
                string favorite     = favSelection == "---" ? "False" : "True";

                //if (!Directory.Exists(directory + folder))
                // Directory.CreateDirectory(directory + folder);

                string destination = Path.Combine(directory, fileName + extension);

                File.Copy(filePath, destination, true);

                FileInfo     info = new FileInfo(destination);
                FileSecurity fs   = info.GetAccessControl();
                AuthorizationRuleCollection rules = fs.GetAccessRules(true, true, typeof(NTAccount));
                string lastmodified = info.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss");
                string now          = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

                fs.SetAccessRuleProtection(true, false);
                fs.AddAccessRule(new FileSystemAccessRule(@"kmhk\itadmin", FileSystemRights.FullControl, AccessControlType.Allow));
                fs.AddAccessRule(new FileSystemAccessRule(AdUtil.GetUserIdByUsername(GlobalService.User, "kmhk.local"), FileSystemRights.FullControl, AccessControlType.Allow));

                string storedDest = destination;

                if (storedDest.Contains("'"))
                {
                    storedDest = storedDest.Replace("'", "''");
                }

                if (fileName.Contains("'"))
                {
                    fileName = fileName.Replace("'", "''");
                }

                if (keyword.Contains("'"))
                {
                    keyword = keyword.Replace("'", "''");
                }

                if (shared != "-")
                {
                    List <string> fileSharedList = shared.Split(';').ToList();

                    List <string> hklist = new List <string>();
                    List <string> cnlist = new List <string>();
                    List <string> vnlist = new List <string>();
                    List <string> jplist = new List <string>();

                    foreach (string item in fileSharedList)
                    {
                        if (UserUtil.IsCnMember(item.Trim()))
                        {
                            cnlist.Add(item.Trim());
                        }
                        else if (UserUtil.IsVnMember(item.Trim()))
                        {
                            vnlist.Add(item.Trim());
                        }
                        else if (UserUtil.IsJpMember(item.Trim()))
                        {
                            jplist.Add(item.Trim());
                        }
                        else
                        {
                            hklist.Add(item.Trim());
                        }
                    }

                    foreach (string fileShared in hklist)
                    {
                        string sharedId  = AdUtil.GetUserIdByUsername(fileShared.Trim(), "kmhk.local");
                        string tableName = "TB_" + sharedId;

                        fs.AddAccessRule(new FileSystemAccessRule(sharedId, FileSystemRights.Modify, AccessControlType.Allow));

                        if (UserUtil.IsSpecialUser(fileShared))
                        //if (fileShared == "Chow Chi To(周志滔,Sammy)" || fileShared == "Ling Wai Man(凌慧敏,Velma)" || fileShared == "Chan Fai Lung(陳輝龍,Onyx)" || fileShared == "Ng Lau Yu, Lilith (吳柳如)" ||
                        //        fileShared == "Lee Miu Wah(李苗華)" || fileShared == "Lee Ming Fung(李銘峯)" || fileShared == "Ho Kin Hang(何健恒,Ken)" || fileShared == "Yeung Wai, Gabriel (楊偉)")
                        {
                            string asText = string.Format("select as_userid from TB_USER_AS where as_user = N'{0}'", fileShared.Trim());
                            string asId   = DataService.GetInstance().ExecuteScalar(asText).ToString().Trim();

                            fs.AddAccessRule(new FileSystemAccessRule(asId, FileSystemRights.Modify, AccessControlType.Allow));
                        }

                        string sharedDivision   = SystemUtil.GetDivision(fileShared.Trim());
                        string sharedDepartment = SystemUtil.GetDepartment(fileShared.Trim());

                        string sharedVpath = sharedDivision != GlobalService.Division && folder.StartsWith(@"\" + GlobalService.Division) ? @"\Documents" + folder
                            : sharedDepartment != GlobalService.Department && folder.StartsWith(@"\Common") ? @"\Documents" + folder : folder;

                        if (sharedVpath.Contains("'"))
                        {
                            sharedVpath = sharedVpath.Replace("'", "''");
                        }

                        string sharedText = string.Format("insert into " + tableName + " (r_filename, r_extension, r_keyword, r_lastaccess, r_lastmodified, r_owner, r_shared, r_path, r_vpath, r_deletedate)" +
                                                          " values (N'{0}', '{1}', N'{2}', '{3}', '{4}', N'{5}', N'{6}', N'{7}', N'{8}', '{9}')", fileName, extension, keyword, now, lastmodified, GlobalService.User,
                                                          fileShared.Trim(), storedDest, sharedVpath, "2099/12/31");

                        queryList.Add(sharedText);
                    }

                    try
                    {
                        File.SetAccessControl(destination, fs);
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message + ex.StackTrace);
                        continue;
                    }

                    if (cnlist.Count > 0)
                    {
                        PermissionUtil.SetGlobalPermission(cnlist, destination, "kmcn.local");
                        SharedUtil.SharedCN(cnlist, storedDest, fileName, keyword);
                    }

                    if (vnlist.Count > 0)
                    {
                        PermissionUtil.SetGlobalPermission(vnlist, destination, "kdtvn.local");
                        SharedUtil.SharedVN(vnlist, storedDest, fileName, keyword);
                    }

                    if (jplist.Count > 0)
                    {
                        PermissionUtil.SetGlobalPermission(jplist, destination, "km.local");
                        SharedUtil.SharedJp(jplist, storedDest, fileName, keyword);
                    }

                    try
                    {
                        List <string> receiverlist = cnlist.Concat(vnlist).Concat(jplist).ToList();
                        if (receiverlist.Count > 0)
                        {
                            EmailUtil.SendNotificationEmail(receiverlist);
                        }
                    }
                    catch (Exception ex)
                    {
                        Debug.WriteLine(ex.Message + ex.StackTrace);
                    }
                }

                GlobalService.RootTable.Rows.Add(fileName, keyword, lastmodified, now, GlobalService.User, shared, destination, folder, 0, favorite, "True", "False");

                if (folder.Contains("'"))
                {
                    folder = folder.Replace("'", "''");
                }

                if (shared == "")
                {
                    shared = "-";
                }

                string ownerText = string.Format("insert into " + GlobalService.DbTable + " (r_filename, r_extension, r_keyword, r_lastaccess, r_lastmodified, r_owner, r_shared, r_path, r_vpath, r_deletedate)" +
                                                 " values (N'{0}', '{1}', N'{2}', '{3}', '{4}', N'{5}', N'{6}', N'{7}', N'{8}', '{9}')", fileName, extension, keyword, now, lastmodified, GlobalService.User,
                                                 shared, storedDest, folder, "2099/12/31");

                queryList.Add(ownerText);
            }

            foreach (string text in queryList)
            {
                DataService.GetInstance().ExecuteNonQuery(text);
            }

            //DataUtil.SyncDataToServer();
            GlobalService.RootTable = RootUtil.RootDataTable();
            this.DialogResult       = DialogResult.OK;
        }
コード例 #6
0
        public ConvertExceptionInfo DetectionFourLine(string[] comments, string[] types, string[] clientFields)
        {
            if (comments.Length < 2 || types.Length < 2 || clientFields.Length < 2)
            {
                return(ConvertExceptionInfo.Warn(string.Format("{0}-({1}),格式不正确,忽略该分页!", _excelName, _sheetName)));
            }

            if (!IsType("TYPE", types))
            {
                return(ConvertExceptionInfo.Warn(ContentInfo("第二行第一列应为TYPE,忽略该分页! " + _defLength)));
            }

            if (!IsType("CLIENT", clientFields))
            {
                return(ConvertExceptionInfo.Warn(ContentInfo("第三行第一列应为CLIENT,忽略该分页!")));
            }


            //  客户端类型
            _sheetClientDefs.Clear();
            int defLength = 0;

            for (int i = 0; i < clientFields.Length; i++)
            {
                var field = clientFields[i];
                // var str = field == null ? "" : field.ToString();
                if (i == 0 || string.IsNullOrEmpty(field))
                {
                    continue;
                }


                string typeStr = string.Empty;
                if (i < types.Length)
                {
                    typeStr = types[i];
                }
                else
                {
                    SystemUtil.Abend(string.Format("{0}-({1})-({2},{3}), [{4}]字段,没有填写类型!",
                                                   _excelName,
                                                   _sheetName,
                                                   3,
                                                   i + 1,
                                                   field));
                }

                var valueType = ValueTypeUtil.String2ValueType(typeStr);
                if (valueType == ValueType.None)
                {
                    SystemUtil.Abend(string.Format("{0}-({1})-({2},{3}), 类型不存在! {4}",
                                                   _excelName,
                                                   _sheetName,
                                                   2,
                                                   i + 1,
                                                   valueType));
                }

                ClientDef def = new ClientDef();
                def.Field     = field;
                def.ValueType = valueType;

                //  主键类型缓存
                if (i == 1)
                {
                    _mainKeyDef.Field     = def.Field;
                    _mainKeyDef.ValueType = def.ValueType;
                }

                _sheetClientDefs.Add(i, def);
                ++defLength;
            }

            if (defLength < 1)
            {
                return(ConvertExceptionInfo.Warn(ContentInfo("该分页没有定义客户端字段,忽略该分页!")));
            }
            // else if (_defLength != -1 && _defLength != defLength)
            // {
            //     SystemUtil.Abend (ContentInfo (string.Format("分页之间,客户端字段数量不匹配! {0} : {1}", _defLength, defLength)));
            // }

            if (_defLength == -1)
            {
                _defLength = defLength;
            }
            return(null);
        }
コード例 #7
0
 public void Open(string path) => SystemUtil.OpenLink(path);
コード例 #8
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            displayRequest.RequestActive();

            CoreWindow.GetForCurrentThread().KeyDown += Global_KeyDown;
            CoreWindow.GetForCurrentThread().KeyUp   += Global_KeyUp;

            var tuple = e.Parameter as Tuple <string, string>;

            switch (tuple?.Item1 ?? "")
            {
            case nameof(StorageType.Local):
            case "":
                TargetStorageType = StorageType.Local;
                break;

            case nameof(StorageType.CameraApi):
                TargetStorageType = StorageType.CameraApi;
                break;

            case nameof(StorageType.Dlna):
                TargetStorageType = StorageType.Dlna;
                break;

#if DEBUG
            case nameof(StorageType.Dummy):
                TargetStorageType = StorageType.Dummy;
                break;
#endif
            }

            RemoteStorageId = tuple?.Item2;

            DebugUtil.Log(() => "OnNavigatedTo: " + TargetStorageType);

            UpdateInnerState(ViewerState.Single);

            Operator = ContentsOperatorFactory.CreateNew(this, RemoteStorageId);

            if (Operator == null)
            {
                DebugUtil.Log(() => "Specified device is invalidated");

                string name = null;
                if (!NetworkObserver.INSTANCE.TryGetDeviceName(RemoteStorageId, out name))
                {
                    name = SystemUtil.GetStringResource("AppBar_RemoteStorage");
                }
                AppShell.Current.Toast.PushToast(new ToastContent
                {
                    Text = string.Format(SystemUtil.GetStringResource("RemoteStorageOffline"), name)
                });
                var task = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    AppShell.Current.AppFrame.GoBack();
                });
                return;
            }

            TitleBarText.Text = Operator.TitleText;

            Operator.SingleContentLoaded += Operator_SingleContentLoaded;
            Operator.ChunkContentsLoaded += Operator_ChunkContentsLoaded;
            Operator.ErrorMessageRaised  += Operator_ErrorMessageRaised;
            Operator.MovieStreamError    += Operator_MovieStreamError;
            Operator.Canceller            = new CancellationTokenSource();

            FinishMoviePlayback();

            PhotoScreen.DataContext = PhotoData;
            SetStillDetailVisibility(false);

            AppShell.Current.BackRequested += BackRequested;

            UpdateTopBar();

            NetworkObserver.INSTANCE.CdsDiscovered    += NetworkObserver_CdsDiscovered;
            NetworkObserver.INSTANCE.CameraDiscovered += NetworkObserver_CameraDiscovered;
            NetworkObserver.INSTANCE.DevicesCleared   += NetworkObserver_DevicesCleared;
            NetworkObserver.INSTANCE.Start();
            if (((Application.Current) as App).IsFunctionLimited && TargetStorageType != StorageType.Local)
            {
                DebugUtil.Log(() => "Showing end of trial message");
                CautionText.Text          = SystemUtil.GetStringResource("TrialMessage");
                CautionText.Visibility    = Visibility.Visible;
                MoreInfoButton.Visibility = Visibility.Visible;
            }
            else
            {
                LoadContents();
            }
        }
コード例 #9
0
 public void Teardown()
 {
     SystemUtil.Reset();
 }
コード例 #10
0
ファイル: ControlForBuildCpt.cs プロジェクト: wobushiren79/IL
    /// <summary>
    /// 建造家具
    /// </summary>
    /// <param name="listBuildPosition"></param>
    protected void BuildItemForFurniture(List <Vector3> listBuildPosition)
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        //将家具添加到家具容器中
        buildItemCpt.transform.parent = InnBuildHandler.Instance.builderForFurniture.buildContainer.transform;
        //增加一个家具
        InnResBean addData = new InnResBean(buildItemCpt.buildItemData.id, buildItemCpt.transform.position, listBuildPosition, buildItemCpt.direction);

        //如果是门。需要重置一下墙体
        if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Door)
        {
            //gameData.GetInnBuildData().InitWall(innBuildManager);
            //innWallBuilder.StartBuild();
        }
        else if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Bed)
        {
            //如果是床。需要加上备注ID
            BuildBedCpt buildBedCpt = (BuildBedCpt)buildItemCpt;
            buildBedCpt.buildBedData.isSet = true;
            addData.remarkId = buildBedCpt.buildBedData.remarkId;
        }
        else if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Stairs)
        {
            BuildStairsCpt buildStairsCpt = (BuildStairsCpt)buildItemCpt;
            //所有坐标下移
            List <Vector3> listFirstBuildPosition = new List <Vector3>();
            foreach (Vector3 itemPosition in listBuildPosition)
            {
                Vector3 firstPostion = itemPosition + new Vector3(0, -100, 0);
                listFirstBuildPosition.Add(firstPostion);
                //删除当前坐标下的建筑
                BuildItemForDismantle(buildLayer - 1, firstPostion, firstPostion);
            }

            //楼下也要添加同样的数据
            GameObject objFirstStairs = Instantiate(InnBuildHandler.Instance.builderForFurniture.buildContainer, buildItemCpt.gameObject);
            objFirstStairs.transform.position += new Vector3(0, -100, 0);
            BuildStairsCpt firstStairs = objFirstStairs.GetComponent <BuildStairsCpt>();
            firstStairs.SetLayer(buildLayer - 1);
            InnResBean addFirstData = new InnResBean(firstStairs.buildItemData.id, objFirstStairs.transform.position, listFirstBuildPosition, firstStairs.direction);
            //设置相同的备注ID
            addData.remarkId      = SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);
            addData.remark        = "2";
            addFirstData.remarkId = addData.remarkId;
            addFirstData.remark   = "1";
            gameData.GetInnBuildData().AddFurniture(buildLayer - 1, addFirstData);
            firstStairs.SetRemarkId(addData.remarkId);
            buildStairsCpt.SetRemarkId(addData.remarkId);
        }
        gameData.GetInnBuildData().AddFurniture(buildLayer, addData);
        //背包里删除一个
        ItemBean itemData = gameData.AddBuildNumber(buildItemCpt.buildItemData.id, -1);

        //动画
        buildItemCpt.transform
        .DOScale(new Vector3(0.2f, 0.2f, 0.2f), 0.5f)
        .From()
        .SetEase(Ease.OutBack);

        if (buildItemCpt.buildItemData.build_type == (int)BuildItemTypeEnum.Bed || itemData.itemNumber <= 0)
        {
            //如果没有了,则不能继续建造
            ClearSelectBuildItem();
        }
        else
        {
            //如果还有则实例化一个新的
            //物体先在建筑控件上显示
            GameObject objCopy = Instantiate(GameControlHandler.Instance.gameObject, buildItemCpt.gameObject);
            objCopy.transform.localScale = new Vector3(1, 1, 1);
            buildItemCpt = objCopy.GetComponent <BaseBuildItemCpt>();
        }
    }
コード例 #11
0
 public void Shutdown()
 {
     SystemUtil.StopAndDestroyTimer(ref _tradePostingTimer);
 }
コード例 #12
0
        private static IDictionary <string, string> Convert(Func <dynamic, ICollection> collectionGetter)
        #endif

        {
            if (!HasHttpContext)
            {
                return(null);
            }

            IDictionary <string, string> dictionary = new Dictionary <string, string>();

            try
            {
                var collection = collectionGetter.Invoke(HttpContext);
                var keys       = Enumerable.ToArray(collection.AllKeys);

                foreach (object key in keys)
                {
                    if (key == null)
                    {
                        continue;
                    }

                    var stringKey = key as string ?? key.ToString();

                    // NOTE: Ignore these keys as they just add duplicate information. [asbjornu]
                    if (stringKey.StartsWith("ALL_") || stringKey.StartsWith("HTTP_"))
                    {
                        continue;
                    }

                    var value       = collection[stringKey];
                    var stringValue = value as string;

                    if (stringValue != null)
                    {
                        // Most dictionary values will be strings and go through this path.
                        dictionary.Add(stringKey, stringValue);
                    }
                    else
                    {
                        // HttpCookieCollection is an ugly, evil beast that needs to be treated with a sledgehammer.

                        try
                        {
                            // For whatever stupid reason, HttpCookie.ToString() doesn't return its Value, so we need to dive into the .Value property like this.
                            #if net35
                            dictionary.Add(stringKey, value);
                            #else
                            dictionary.Add(stringKey, value.Value);
                            #endif
                        }
                        catch (Exception exception)
                        {
                            dictionary.Add(stringKey, exception.ToString());
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                SystemUtil.WriteError(exception);
            }

            return(dictionary);
        }
コード例 #13
0
 public CampDataBean()
 {
     belongId = "Camp_" + SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);
     SetCampColor(new Color(UnityEngine.Random.Range(0, 1), UnityEngine.Random.Range(0, 1), UnityEngine.Random.Range(0, 1)));
 }
コード例 #14
0
        // TODO generalize
        public virtual X509Certificate BuildAuthorizedOCSPResponderCert()
        {
            X509Name                   subjectDnName    = new X509Name(subjectDN);
            BigInteger                 certSerialNumber = new BigInteger(Convert.ToString(SystemUtil.GetTimeBasedSeed())); // Using the current timestamp as the certificate serial number
            ISignatureFactory          contentSigner    = new Asn1SignatureFactory(signatureAlgorithm, (AsymmetricKeyParameter)signingKey);
            X509V3CertificateGenerator certBuilder      = new X509V3CertificateGenerator();

            certBuilder.SetIssuerDN(signingCert.SubjectDN);
            certBuilder.SetSerialNumber(certSerialNumber);
            certBuilder.SetNotBefore(startDate);
            certBuilder.SetNotAfter(endDate);
            certBuilder.SetSubjectDN(subjectDnName);
            certBuilder.SetPublicKey(publicKey);

            // TODO generalize extensions setting
            // Extensions --------------------------
            bool ca = true;

            AddExtension(X509Extensions.BasicConstraints, true, new BasicConstraints(ca),
                         certBuilder);

            AddExtension(OcspObjectIdentifiers.PkixOcspNocheck, false, Org.BouncyCastle.Asn1.DerNull.Instance,
                         certBuilder);

            AddExtension(X509Extensions.KeyUsage, false, new KeyUsage(KeyUsage.DigitalSignature | KeyUsage.NonRepudiation),
                         certBuilder);

            AddExtension(X509Extensions.ExtendedKeyUsage, false, new ExtendedKeyUsage(KeyPurposeID.IdKPOcspSigning),
                         certBuilder);

            SubjectPublicKeyInfo   issuerPublicKeyInfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(signingCert.GetPublicKey());
            AuthorityKeyIdentifier authKeyIdentifier   = new AuthorityKeyIdentifier(issuerPublicKeyInfo);

            AddExtension(X509Extensions.AuthorityKeyIdentifier, false, authKeyIdentifier, certBuilder);

            SubjectPublicKeyInfo subjectPublicKeyInfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey);
            SubjectKeyIdentifier subjectKeyIdentifier = new SubjectKeyIdentifier(subjectPublicKeyInfo);

            AddExtension(X509Extensions.SubjectKeyIdentifier, false, subjectKeyIdentifier, certBuilder);
            // -------------------------------------
            return(certBuilder.Generate(contentSigner));
        }
コード例 #15
0
ファイル: AppSettingPage.xaml.cs プロジェクト: zmrzli/locana
        private static SettingSection BuildShootingSection()
        {
            var section = new SettingSection(SystemUtil.GetStringResource("SettingSection_Image"));

            section.Add(new ToggleSetting
            {
                SettingData = new AppSettingData <bool>()
                {
                    Title         = SystemUtil.GetStringResource("PostviewTransferSetting"),
                    Guide         = SystemUtil.GetStringResource("Guide_ReceiveCapturedImage"),
                    StateProvider = () => ApplicationSettings.GetInstance().IsPostviewTransferEnabled,
                    StateObserver = enabled => ApplicationSettings.GetInstance().IsPostviewTransferEnabled = enabled
                }
            });

            var limited = (Application.Current as App).IsFunctionLimited;

            var geoGuide = limited ? "TrialMessage" : "AddGeotag_guide";
            AppSettingData <bool> geoSetting = null;

            geoSetting = new AppSettingData <bool>()
            {
                Title         = SystemUtil.GetStringResource("AddGeotag"),
                Guide         = SystemUtil.GetStringResource(geoGuide),
                StateProvider = () =>
                {
                    if (limited)
                    {
                        return(false);
                    }
                    else
                    {
                        return(ApplicationSettings.GetInstance().GeotagEnabled);
                    }
                },
                StateObserver = enabled =>
                {
                    ApplicationSettings.GetInstance().GeotagEnabled = enabled;
                    if (enabled)
                    {
                        RequestPermission(geoSetting);
                    }
                }
            };
            var geoToggle = new ToggleSetting {
                SettingData = geoSetting
            };

            if (ApplicationSettings.GetInstance().GeotagEnabled)
            {
                RequestPermission(geoSetting);
            }

            if (limited)
            {
                ApplicationSettings.GetInstance().GeotagEnabled = false;
                geoSetting.IsActive = false;
            }
            section.Add(geoToggle);

            return(section);
        }
コード例 #16
0
 /// <summary>
 /// 离开游戏
 /// </summary>
 private void exitOnClick()
 {
     SoundUtil.playSoundClip(AudioButtonOnClickEnum.btn_sound_1);
     SystemUtil.exitGame();
 }
コード例 #17
0
        public ConvertExceptionInfo ConvertSheet(ISheetReader sheetReader)
        {
            _sheetName = sheetReader.GetSheetName();
            //  1. 分页第一行第一列是否有值
            var firstValue = sheetReader.GetCell(1, 1);

            if (string.IsNullOrEmpty(firstValue.ToString()))
            {
                SystemUtil.Wran(string.Format("SheetName [{0}] 不导出!", sheetReader.GetSheetName()));
                return(null);
            }

            //  2. 检查客户端字段以及类型定义
            var error = DetectionFourLine(sheetReader.GetLineCell(1), sheetReader.GetLineCell(2), sheetReader.GetLineCell(3));

            if (error != null)
            {
                SystemUtil.Print(error);
                if (error.InfoType == ExceptionInfoType.Warn)
                {
                    return(null);
                }
            }

            //  Event
            EventHandel?.OnConvertSheetStart(_sheetName, sheetReader);

            int currentRow = START_ROW;

            //  Test
            if (sheetReader.HasFirst("TEST"))
            {
                currentRow++;
            }


            bool isBreak = false;

            string[] lineData = null;

            while (true)
            {
                if (isBreak)
                {
                    //  结束
                    break;
                }

                //  执行行命令
                var lineCmd = ParseCmd(sheetReader.GetCell(currentRow, sheetReader.StartCol));
                if (lineCmd == LineCmd.Ignore)
                {
                    ++currentRow;
                    continue;
                }
                else if (lineCmd == LineCmd.EndBefore)
                {
                    break;
                }
                else if (lineCmd == LineCmd.End)
                {
                    isBreak = true;
                }

                //  获取行数据
                lineData = sheetReader.GetLineCell(currentRow);
                if (lineData == null)
                {
                    isBreak = true;
                    if (currentRow == START_ROW)
                    {
                        SystemUtil.Wran(ContentInfo("分页为空,不导出!"));
                    }
                    else
                    {
                        SystemUtil.Wran(ContentInfo(string.Format("({0})行数据为空,自动跳出!", currentRow)));
                    }
                    continue;
                }

                //  导出为lua
                ParseLine(lineData, currentRow);
                EventHandel?.OnConvertSheetLine(currentRow, lineData);
                ++_convertCount;
                ++currentRow;
            }

            EventHandel?.OnConvertSheetEnd(_sheetName);

            SystemUtil.Log(ContentInfo("Finish!"), System.ConsoleColor.Green);
            return(null);
        }
コード例 #18
0
        protected virtual void Configuration(LogConfig logConfig)
        {
            var directory = SystemUtil.GetPorjectRootDirectory();

            JsonHelper.FromJsonFile(directory + "/Configuration/Logger.json", logConfig);
        }
コード例 #19
0
 public void OpenDir() => SystemUtil.OpenLink(_gamePathService.ShaderPacksDir);
コード例 #20
0
        protected virtual void Configuration(CryptoConfig cryptoConfig)
        {
            var directory = SystemUtil.GetPorjectRootDirectory();

            JsonHelper.FromJsonFile(directory + "/Configuration/Encryptor.json", cryptoConfig);
        }
コード例 #21
0
ファイル: AboutViewModel.cs プロジェクト: lotsmon/GBCLV3
 public void OpenLink(string url) => SystemUtil.OpenLink(url);
コード例 #22
0
        protected virtual void Configuration(NetworkConfig networkConfig)
        {
            var directory = SystemUtil.GetPorjectRootDirectory();

            JsonHelper.FromJsonFile(directory + "/Configuration/Services.json", networkConfig);
        }
コード例 #23
0
        private PeriodicalShootingTask SetupPeriodicalShooting()
        {
            var task = new PeriodicalShootingTask(new List <TargetDevice>()
            {
                target
            }, ApplicationSettings.GetInstance().IntervalTime);

            task.Tick += async(result) =>
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    switch (result)
                    {
                    case PeriodicalShootingTask.PeriodicalShootingResult.Skipped:
                        AppShell.Current.Toast.PushToast(new ToastContent {
                            Text = SystemUtil.GetStringResource("PeriodicalShooting_Skipped")
                        });
                        break;

                    case PeriodicalShootingTask.PeriodicalShootingResult.Succeed:
                        AppShell.Current.Toast.PushToast(new ToastContent
                        {
                            Text = string.Format(SystemUtil.GetStringResource("PeriodicalShooting_Status"),
                                                 PeriodicalShootingTask.Interval.ToString(),
                                                 PeriodicalShootingTask.Count.ToString())
                        });
                        break;
                    }
                    ;
                });
            };
            task.Stopped += async(reason) =>
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    switch (reason)
                    {
                    case PeriodicalShootingTask.StopReason.ShootingFailed:
                        AppShell.Current.Toast.PushToast(new ToastContent {
                            Text = SystemUtil.GetStringResource("ErrorMessage_Interval")
                        });
                        break;

                    case PeriodicalShootingTask.StopReason.SkipLimitExceeded:
                        AppShell.Current.Toast.PushToast(new ToastContent {
                            Text = SystemUtil.GetStringResource("PeriodicalShooting_SkipLimitExceed")
                        });
                        break;

                    case PeriodicalShootingTask.StopReason.RequestedByUser:
                        AppShell.Current.Toast.PushToast(new ToastContent {
                            Text = SystemUtil.GetStringResource("PeriodicalShooting_StoppedByUser")
                        });
                        break;
                    }
                    ;
                });
            };
            task.StatusUpdated += (status) =>
            {
                ScreenViewData.IsPeriodicalShootingRunning = status.IsRunning;
                ControlPanel.SetChildrenControlHitTest(!status.IsRunning);
                ControlPanel.SetChildrenControlTabStop(!status.IsRunning);
                UpdateShutterButton(target.Status);

                /*
                 * await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                 * {
                 *  DebugUtil.Log(() => "Status updated: " + status.Count);
                 *
                 *  PeriodicalShootingStatus.Visibility = status.IsRunning.AsVisibility();
                 *  if (status.IsRunning)
                 *  {
                 *      PeriodicalShootingStatusText.Text = string.Format(
                 *          SystemUtil.GetStringResource("PeriodicalShooting_Status"),
                 *          status.Interval.ToString(),
                 *          status.Count.ToString());
                 *  }
                 * });
                 */
            };
            return(task);
        }
コード例 #24
0
/// <summary>
/// Right-click commands on objects in a tree
/// </summary>
/// <param name="command">The command to process</param>
        /// <param name="mtn">MetaTreeNode</param>
        /// <param name="uo">Any associated user object</param>
        /// <param name="ctc">ContentsTreeControl</param>
/// <returns></returns>

        public static bool ProcessCommonRightClickObjectMenuCommands(
            string command,
            MetaTreeNode mtn,
            UserObject[] uoArray,
            ContentsTreeControl ctc)
        {
            UserObject uo2;
            string     txt;
            UserObject uo = null;

            if (uoArray != null && uoArray.Length == 1)
            {
                uo = uoArray[0];
            }

            //if (mtn == null)
            //{
            //	MessageBoxMx.ShowError("Operation is not allowed for this Database Contents node.");
            //	return true;
            //}

            if (Lex.Eq(command, "Cut"))
            {
                CopyCutDelete(command, uoArray, ctc, true, true);
            }

            else if (Lex.Eq(command, "Copy"))
            {
                CopyCutDelete(command, uoArray, ctc, true, false);
            }

            else if (Lex.Eq(command, "Paste"))
            {
                try
                {
                    txt = Clipboard.GetText();
                    //uo2 = UserObject.Deserialize(txt);
                    uoArray = Deserialize(txt);
                    if (uoArray == null)
                    {
                        throw new Exception("Not a UserObject");
                    }
                    //if (uo2 == null) throw new Exception("Not a UserObject");
                }
                catch (Exception ex)
                {
                    MessageBoxMx.ShowError("The clipboard does not contain a recognized user objects");
                    return(true);
                }

                foreach (var userObject in uoArray)
                {
                    Progress.Show("Pasting " + userObject.Name + "...", UmlautMobius.String, false);

                    Permissions.UpdateAclForNewOwner(userObject, userObject.Owner, SS.I.UserName); // fixup the ACL for the new owner
                    userObject.Owner        = SS.I.UserName;
                    userObject.ParentFolder = mtn.Name;
                    mtn = UserObjectTree.GetValidUserObjectTypeFolder(userObject);

                    for (int ci = 0; ; ci++) // find a name that's not used
                    {
                        UserObject uo3 = UserObjectDao.ReadHeader(userObject);
                        if (uo3 == null)
                        {
                            break;
                        }

                        if (ci == 0)
                        {
                            userObject.Name = "Copy of " + userObject.Name;
                        }
                        else if (ci == 1)
                        {
                            userObject.Name = Lex.Replace(userObject.Name, "Copy of ", "Copy (2) of ");
                        }
                        else
                        {
                            userObject.Name = Lex.Replace(userObject.Name, "Copy (" + ci + ") of ", "Copy (" + (ci + 1) + ") of ");
                        }
                    }

                    UserObject userObjectFinal = null;
                    if (UserObjectDao.ReadHeader(userObject.Id) != null) // create a deep clone if orignal object exists
                    {
                        userObjectFinal = DeepClone(userObject);
                    }

                    if (userObjectFinal == null)
                    {
                        userObjectFinal = userObject;
                    }

                    UserObjectDao.Write(userObjectFinal, userObjectFinal.Id); // write using the current id

                    Progress.Hide();
                }

                //if (ctc != null) // need to update form directly?
                //  UserObjectTree.RefreshSubtreeInTreeControl(uo2, ctc);
            }

            else if (Lex.Eq(command, "Delete"))
            {
                CopyCutDelete(command, uoArray, ctc, false, true);
            }

            else if (Lex.Eq(command, "Rename"))
            {
                if (!UserHasWriteAccess(uo))
                {
                    MessageBoxMx.ShowError("You are not authorized to rename " + uo.Name);
                    return(true);
                }

                string newName = InputBoxMx.Show("Enter the new name for " + uo.Name,
                                                 "Rename", uo.Name);

                if (newName == null || newName == "" || newName == uo.Name)
                {
                    return(true);
                }

                if (!IsValidUserObjectName(newName))
                {
                    MessageBoxMx.ShowError("The name " + newName + " is not valid.");
                    return(true);
                }

                uo2      = uo.Clone();
                uo2.Name = newName;
                uo2.Id   = 0;               // clear Id so not looked up by id

                if (!Lex.Eq(newName, uo.Name) && UserObjectDao.ReadHeader(uo2) != null)
                {
                    MessageBoxMx.ShowError(newName + " already exists.");
                    return(true);
                }

                uo2.Id = uo.Id;
                UserObjectDao.UpdateHeader(uo2);

                if (ctc != null)
                {
                    UserObjectTree.UpdateObjectInTreeControl(uo, uo2, ctc);
                }
            }

            else if (Lex.Eq(command, "MakePublic") ||
                     Lex.Eq(command, "MakePrivate"))
            {
                UserObjectAccess newAccess;
                MetaTreeNode     objFolder;

                if (!UserHasWriteAccess(uo))
                {
                    MessageBoxMx.ShowError("You are not authorized to make " + uo.Name +
                                           ((Lex.Eq(command, "MakePublic")) ? " public" : " private"));
                    return(true);
                }

                if (Lex.Eq(command, "MakePublic"))
                {
                    if (uo.ParentFolder == "DEFAULT_FOLDER")
                    {
                        MessageBoxMx.ShowError("Items in the Default Folder cannot be made public");
                        return(true);
                    }
                    else
                    {
                        //check the folder id parentage to ensure that the current folder isn't a subfolder of the default folder
                        if (UserObjectTree.FolderNodes.ContainsKey(uo.ParentFolder))
                        {
                            objFolder = UserObjectTree.FolderNodes[uo.ParentFolder];
                            while (objFolder != null)
                            {
                                if (objFolder.Target == "DEFAULT_FOLDER")
                                {
                                    MessageBoxMx.ShowError("Items in the Default Folder cannot be made public");
                                    return(true);
                                }
                                objFolder = objFolder.Parent;
                            }
                        }
                        else
                        {
                            throw new Exception("Failed to recognize the folder that this object is in!");
                        }
                    }

                    newAccess = UserObjectAccess.Public;
                }
                else
                {
                    //user folders cannot be made private if they contain public children
                    if (uo.Type == UserObjectType.Folder)
                    {
                        objFolder = UserObjectTree.BuildNode(uo);
                        if (UserObjectTree.FolderNodes.ContainsKey(objFolder.Target))
                        {
                            objFolder = UserObjectTree.FolderNodes[objFolder.Target];
                            for (int i = 0; i < objFolder.Nodes.Count; i++)
                            {
                                MetaTreeNode currentChild = (MetaTreeNode)objFolder.Nodes[i];
                            }
                        }
                    }

                    newAccess = UserObjectAccess.Private;
                }

                uo2 = UserObjectDao.Read(uo);
                if (uo2 == null)
                {
                    return(true);
                }
                if (uo2.AccessLevel == newAccess)
                {
                    return(true);                                              // no change
                }
                uo2.AccessLevel = newAccess;
                UserObjectDao.UpdateHeader(uo2);

                if (ctc != null)                 // need to update form directly?
                {
                    UserObjectTree.RefreshSubtreeInTreeControl(uo2, ctc);
                }

                return(true);
            }

            else if (Lex.Eq(command, "ChangeOwner"))
            {
                string newOwner = InputBoxMx.Show("Enter the user name of the person to transfer ownership of " + Lex.AddDoubleQuotes(uo.Name) + " to:",
                                                  "Change Owner", "");

                if (Lex.IsNullOrEmpty(newOwner))
                {
                    return(true);
                }

                string result = UserObjectUtil.ChangeOwner(uo.Id, newOwner);
                if (!Lex.IsNullOrEmpty(result))
                {
                    MessageBoxMx.Show(result);
                }
                return(true);
            }

            else if (Lex.Eq(command, "Permissions"))             // set object permissions
            {
                PermissionsDialog.Show(uo);
                return(true);
            }

            else if (Lex.Eq(command, "ViewSource"))
            {
                uo = UserObjectDao.Read(uo);
                if (uo == null)
                {
                    return(true);
                }

                string ext = ".txt";                 // default extension
                if (uo.Type == UserObjectType.Query ||
                    uo.Type == UserObjectType.Annotation)
                {
                    ext = ".xml";
                }
                string       cFile = ClientDirs.TempDir + @"\Source" + ext;
                StreamWriter sw    = new StreamWriter(cFile);
                sw.Write(uo.Content);
                sw.Close();

                SystemUtil.StartProcess(cFile);                 // show it
            }

            else
            {
                return(false);       // command not recognized
            }
            return(true);            // command recognized and processed
        }
コード例 #25
0
 public void Report() => SystemUtil.OpenLink(ISSUES_URL);
コード例 #26
0
ファイル: GameTimeHandler.cs プロジェクト: wobushiren79/IL
    /// <summary>
    /// 开始新的一天
    /// </summary>
    public void SetNewDay()
    {
        GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData();

        //初始化世界种子
        GameCommonInfo.RandomSeed = UnityEngine.Random.Range(int.MinValue, int.MaxValue);
        GameCommonInfo.InitRandomSeed();
        //解除每日
        GameCommonInfo.DailyLimitData.InitData(gameData);
        //初始化时间
        SetTimeStatus(true);
        hour = 6;
        min  = 0;
        //如果有建筑日则建筑日减一天
        InnBuildBean innBuildData = gameData.GetInnBuildData();

        if (innBuildData.listBuildDay.Count > 0)
        {
            //检测当前日子是否包含在建筑日内
            TimeBean timeData   = gameData.gameTime;
            bool     isBuildDay = false;
            foreach (TimeBean itemTime in innBuildData.listBuildDay)
            {
                if (itemTime.year == timeData.year && itemTime.month == timeData.month && itemTime.day == timeData.day)
                {
                    isBuildDay = true;
                }
            }
            if (!isBuildDay)
            {
                innBuildData.listBuildDay.Clear();
                //检测是1楼还是2楼
                if (innBuildData.buildInnWidth != 0 || innBuildData.buildInnHeight != 0)
                {
                    innBuildData.ChangeInnSize(1, innBuildData.buildInnWidth, innBuildData.buildInnHeight);
                    innBuildData.buildInnWidth  = 0;
                    innBuildData.buildInnHeight = 0;
                }
                else if (innBuildData.buildInnSecondWidth != 0 || innBuildData.buildInnSecondHeight != 0)
                {
                    innBuildData.ChangeInnSize(2, innBuildData.buildInnSecondWidth, innBuildData.buildInnSecondHeight);
                    innBuildData.buildInnSecondWidth  = 0;
                    innBuildData.buildInnSecondHeight = 0;
                }


                InnBuildHandler.Instance.builderForFloor.StartBuild();
                InnBuildHandler.Instance.builderForWall.StartBuild();
            }
        }
        //增加家族成员日子
        List <CharacterForFamilyBean> listFamilyData = gameData.GetFamilyData().GetAllFamilyData();

        if (!CheckUtil.ListIsNull(listFamilyData))
        {
            for (int i = 0; i < listFamilyData.Count; i++)
            {
                CharacterForFamilyBean itemData = listFamilyData[i];
                itemData.AddBirthDay(1);
            }
        }

        //通知新的一天
        notifyForTime?.Invoke(NotifyTypeEnum.NewDay, -1);
        SystemUtil.GCCollect();
    }
コード例 #27
0
 private void TriggerTimedUpdate(object stateInfo)
 {
     _ = base.Update(DiscordLink.Obj, DLEventType.Timer, null);
     SystemUtil.StopAndDestroyTimer(ref _HighFrequencyEventTimer);
 }
コード例 #28
0
ファイル: AppSettingPage.xaml.cs プロジェクト: zmrzli/locana
        private static SettingSection BuildDisplaySection()
        {
            var section = new SettingSection(SystemUtil.GetStringResource("SettingSection_Display"));

            section.Add(new ToggleSetting
            {
                SettingData = new AppSettingData <bool>()
                {
                    Title         = SystemUtil.GetStringResource("DisplayTakeImageButtonSetting"),
                    Guide         = SystemUtil.GetStringResource("Guide_DisplayTakeImageButtonSetting"),
                    StateProvider = () => ApplicationSettings.GetInstance().IsShootButtonDisplayed,
                    StateObserver = enabled => ApplicationSettings.GetInstance().IsShootButtonDisplayed = enabled
                }
            });

            section.Add(new ToggleSetting
            {
                SettingData = new AppSettingData <bool>()
                {
                    Title         = SystemUtil.GetStringResource("DisplayHistogram"),
                    Guide         = SystemUtil.GetStringResource("Guide_Histogram"),
                    StateProvider = () => ApplicationSettings.GetInstance().IsHistogramDisplayed,
                    StateObserver = enabled => ApplicationSettings.GetInstance().IsHistogramDisplayed = enabled
                }
            });

            var FocusFrameSetting = new AppSettingData <bool>()
            {
                Title         = SystemUtil.GetStringResource("FocusFrameDisplay"),
                Guide         = SystemUtil.GetStringResource("Guide_FocusFrameDisplay"),
                StateProvider = () => ApplicationSettings.GetInstance().RequestFocusFrameInfo,
                StateObserver = enabled =>
                {
                    ApplicationSettings.GetInstance().RequestFocusFrameInfo = enabled;
                    // todo: support to show focus frames
                    //await SetupFocusFrame(enabled);
                    //if (!enabled) { _FocusFrameSurface.ClearFrames(); }
                }
            };

            section.Add(new ToggleSetting {
                SettingData = FocusFrameSetting
            });

            section.Add(new ToggleSetting
            {
                SettingData = new AppSettingData <bool>()
                {
                    Title         = SystemUtil.GetStringResource("LiveviewRotation"),
                    Guide         = SystemUtil.GetStringResource("LiveviewRotation_guide"),
                    StateProvider = () => ApplicationSettings.GetInstance().LiveviewRotationEnabled,
                    StateObserver = enabled =>
                    {
                        ApplicationSettings.GetInstance().LiveviewRotationEnabled = enabled;
                        // todo: support to rotate liveview image
                        //if (enabled && target != null && target.Status != null)
                        //{
                        //    RotateLiveviewImage(target.Status.LiveviewOrientationAsDouble);
                        //}
                        //else
                        //{
                        //    RotateLiveviewImage(0);
                        //}
                    }
                }
            });

            section.Add(new ToggleSetting
            {
                SettingData = new AppSettingData <bool>()
                {
                    Title         = SystemUtil.GetStringResource("FramingGrids"),
                    Guide         = SystemUtil.GetStringResource("Guide_FramingGrids"),
                    StateProvider = () => ApplicationSettings.GetInstance().FramingGridEnabled,
                    StateObserver = enabled =>
                    {
                        ApplicationSettings.GetInstance().FramingGridEnabled = enabled;
                        // screen_view_data.FramingGridDisplayed = enabled;
                    }
                }
            });

            var gridTypePanel = new ComboBoxSetting(new AppSettingData <int>()
            {
                Title         = SystemUtil.GetStringResource("AssistPattern"),
                StateProvider = () => (int)ApplicationSettings.GetInstance().GridType - 1,
                StateObserver = setting =>
                {
                    if (setting < 0)
                    {
                        return;
                    }
                    ApplicationSettings.GetInstance().GridType = (FramingGridTypes)(setting + 1);
                },
                Candidates = SettingValueConverter.FromFramingGrid(EnumUtil <FramingGridTypes> .GetValueEnumerable())
            });

            gridTypePanel.SetBinding(VisibilityProperty, new Binding
            {
                Source    = ApplicationSettings.GetInstance(),
                Path      = new PropertyPath(nameof(ApplicationSettings.FramingGridEnabled)),
                Mode      = BindingMode.OneWay,
                Converter = new BoolToVisibilityConverter(),
            });
            section.Add(gridTypePanel);

            var gridColorPanel = new ComboBoxSetting(new AppSettingData <int>()
            {
                Title         = SystemUtil.GetStringResource("FramingGridColor"),
                StateProvider = () => (int)ApplicationSettings.GetInstance().GridColor,
                StateObserver = setting =>
                {
                    if (setting < 0)
                    {
                        return;
                    }
                    ApplicationSettings.GetInstance().GridColor = (FramingGridColors)setting;
                },
                Candidates = SettingValueConverter.FromFramingGridColor(EnumUtil <FramingGridColors> .GetValueEnumerable())
            });

            gridColorPanel.SetBinding(VisibilityProperty, new Binding
            {
                Source    = ApplicationSettings.GetInstance(),
                Path      = new PropertyPath(nameof(ApplicationSettings.FramingGridEnabled)),
                Mode      = BindingMode.OneWay,
                Converter = new BoolToVisibilityConverter(),
            });
            section.Add(gridColorPanel);

            var fibonacciOriginPanel = new ComboBoxSetting(new AppSettingData <int>()
            {
                Title         = SystemUtil.GetStringResource("FibonacciSpiralOrigin"),
                StateProvider = () => (int)ApplicationSettings.GetInstance().FibonacciLineOrigin,
                StateObserver = setting =>
                {
                    if (setting < 0)
                    {
                        return;
                    }
                    ApplicationSettings.GetInstance().FibonacciLineOrigin = (FibonacciLineOrigins)setting;
                },
                Candidates = SettingValueConverter.FromFibonacciLineOrigin(EnumUtil <FibonacciLineOrigins> .GetValueEnumerable())
            });

            fibonacciOriginPanel.SetBinding(VisibilityProperty, new Binding
            {
                Source    = ApplicationSettings.GetInstance(),
                Path      = new PropertyPath(nameof(ApplicationSettings.IsFibonacciSpiralEnabled)),
                Mode      = BindingMode.OneWay,
                Converter = new BoolToVisibilityConverter(),
            });
            section.Add(fibonacciOriginPanel);

            section.Add(new ToggleSetting
            {
                SettingData = new AppSettingData <bool>()
                {
                    Title         = SystemUtil.GetStringResource("ForcePhoneView"),
                    Guide         = SystemUtil.GetStringResource("ForcePhoneView_Guide"),
                    StateProvider = () => ApplicationSettings.GetInstance().ForcePhoneView,
                    StateObserver = enabled => ApplicationSettings.GetInstance().ForcePhoneView = enabled
                }
            });

            return(section);
        }
コード例 #29
0
    /*==========================================================================*/
    /*		func																*/
    /*==========================================================================*/
    //----------------------------------------------------------------------------

    /*!
     *          @brief	Unity固有処理:初期化処理	※初回のUpdateを呼び出す直前に呼出し
     */
    //----------------------------------------------------------------------------
    protected override void Start()
    {
        base.Start();

        //--------------------------------
        //	回転制御許可設定
        //--------------------------------
        Screen.orientation                    = ScreenOrientation.AutoRotation;
        Screen.autorotateToPortrait           = true;
        Screen.autorotateToPortraitUpsideDown = true;
        Screen.autorotateToLandscapeLeft      = false;
        Screen.autorotateToLandscapeRight     = false;

#if true
        //--------------------------------
        // ビルド情報をログ出力。
        //
        // マスター版で焼いた際にログが出なくて、
        // それぞれのシンボル情報の確証が得にくいので情報として出しておく
        //--------------------------------
        string strApplicationSymbolData = "BuildParam - ";

#if UNITY_IPHONE
        strApplicationSymbolData += " Platform:iOS , ";
#elif UNITY_ANDROID
        strApplicationSymbolData += " Platform:Android , ";
#else
        strApplicationSymbolData += " Platform:????? , ";
#endif

#if BUILD_TYPE_DEBUG
        strApplicationSymbolData += " BuildType:debug , ";
#else
        strApplicationSymbolData += "";
#endif

#if STORE_SIMULATION
        strApplicationSymbolData += " Store:disable , ";
#else
        strApplicationSymbolData += " Store:enable , ";
#endif

#if _MASTER_BUILD
        strApplicationSymbolData += " Master:On , ";
#else
        strApplicationSymbolData += " Master:Off , ";
#endif

        UnityEngine.Debug.Log(strApplicationSymbolData);
#endif

#if BUILD_TYPE_DEBUG && UNITY_EDITOR
        //--------------------------------
        //
        //--------------------------------
        Application.runInBackground = true;
#endif // #if BUILD_TYPE_DEBUG && UNITY_EDITOR


        //--------------------------------
        // staticパラメータのクリア
        //--------------------------------
        ResidentParam.ParamReset();

        //--------------------------------
        // マルチタッチ無効
        //--------------------------------
        Input.multiTouchEnabled = false;

        //--------------------------------
        // 負荷軽減モードの適用分岐
        //--------------------------------
        if (SystemUtil.GetLoadReductionMode() == true)
        {
            ResidentParam.m_OptionWorkLoadLevel = 1;
        }
        else
        {
            ResidentParam.m_OptionWorkLoadLevel = 0;
        }

#if BUILD_TYPE_DEBUG
#if DEBUG_LOG
        m_ManagerMemoryLog = MemoryLogManager.getInstance();
#endif // DEBUG_LOG
#endif

        //--------------------------------
        // ローカルのセーブ情報をユーザークラスに譲渡するためロード実行
        //--------------------------------
        if (LocalSaveManager.Instance != null)
        {
            // 2015/07/15 k_iida V280 招待機能先送りに伴い封印する V290復活予定.
            //			LocalSaveStorage.Instance.InitLocalSaveStorage( "DivineGate" );
            LocalSaveManager.SaveVersionSafety();
            LocalSaveManager.Instance.LoadFuncUUID();
            LocalSaveManager.Instance.LoadFuncLocalData();
            //			LocalSaveManager.Instance.LoadFuncRestore();
        }
        else
        {
            Debug.LogError("LocalSaveManager None!");
        }

        //--------------------------------
        // Prime31 PlayGameServices 初期化処理
        //--------------------------------
        PlayGameServiceUtil.InitPlayGameService();

        //--------------------------------
        // サーバープッシュ通知初期化
        // @add Developer 2016/10/31
        //--------------------------------
        RemoteNotificationManager.Init();
    }
コード例 #30
0
        private void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                SetProgressBar(60);

                SetLabel("Initializing components");

                //this.LoadUserAppData();

                SetProgressBar(100);

                SetLabel("Getting user information");

                //GlobalService.User = "******";
                //GlobalService.DbTable = "TB_hk950097";

                /*if (domain == "kmhk.local")
                 *  GlobalService.DbTable = "TB_" + AdUtil.GetUserIdByUsername(GlobalService.User, "kmhk.local");
                 * else
                 * {
                 *  string id = AdUtil.GetUserIdByUsername(GlobalService.User, domain);
                 *
                 *  string tb = id == "as1600048" ? "hk070022"
                 *      : id == "as1600049" ? "hk110017"
                 *      : id == "as1600050" ? "hk040015"
                 *      : id == "as1600051" ? "hk160002"
                 *      : id == "as1600053" ? "hk950330"
                 *      : id == "as1600054" ? "hk110023"
                 *      : id == "as1600055" ? "hk120027"
                 *      : id == "as1600056" ? "hk140005" : "";
                 *
                 *  GlobalService.DbTable = "TB_" + tb;
                 *
                 *  string name = id == "as1600048" ? "Chow Chi To(周志滔,Sammy)"
                 *      : id == "as1600049" ? "Ling Wai Man(凌慧敏,Velma)"
                 *      : id == "as1600050" ? "Chan Fai Lung(陳輝龍,Onyx)"
                 *      : id == "as1600051" ? "Ng Lau Yu, Lilith (吳柳如)"
                 *      : id == "as1600053" ? "Lee Miu Wah(李苗華)"
                 *      : id == "as1600054" ? "Lee Ming Fung(李銘峯)"
                 *      : id == "as1600055" ? "Ho Kin Hang(何健恒,Ken)"
                 *      : id == "as1600056" ? "Yeung Wai, Gabriel (楊偉)" : "";
                 *
                 *  GlobalService.User = name;
                 * }*/

                //List<string> list = new List<string>();
                //list.Add(GlobalService.User);
                //EmailUtil.SendNotificationEmail(list);

                GlobalService.User = GlobalService.User.Trim();

                try
                {
                    SetLabel("Synchronizing data");

                    SharedUtil.AutoDeleteData();

                    Stopwatch sw = new Stopwatch();

                    sw.Start();
                    GlobalService.DepartmentFolder = SetupUtil.GetDepartmentFolder(GlobalService.User);
                    sw.Stop();
                    Debug.WriteLine("Get Department Folder: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.DivisionMemberList = SystemUtil.DivisionMember(GlobalService.User);
                    sw.Stop();
                    Debug.WriteLine("Get Division Memeber: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.DepartmentMemberList = SystemUtil.DepartmentMember(GlobalService.User);
                    sw.Stop();
                    Debug.WriteLine("Get Department Member: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.SystemGroupList = GroupUtil.SystemGroupList();
                    GlobalService.CNGroupList     = GroupUtil.CnGroupList();
                    GlobalService.VNGroupList     = GroupUtil.VnGroupList();
                    GlobalService.JPGroupList     = GroupUtil.JpGroupList();
                    sw.Stop();
                    Debug.WriteLine("Get System Group: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.CustomGroupList = GroupUtil.CustomGroupList2(GlobalService.User);
                    sw.Stop();
                    Debug.WriteLine("Get Custom Group: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.AllUserList = UserUtil.AllUserList();
                    GlobalService.CnUserList  = UserUtil.CnUserList();
                    GlobalService.VnUserList  = UserUtil.VnUserList();
                    GlobalService.JpUserList  = UserUtil.JpUserList();
                    sw.Stop();
                    Debug.WriteLine("Get All User: "******"Initialize attachment list: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.ExtraSystemGroupList = GroupUtil.ExtraSystemGroupList();
                    sw.Stop();
                    Debug.WriteLine("Get Extra System Group: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.NoticeList = MessageUtil.GetNoticeList();
                    sw.Stop();
                    Debug.WriteLine("Get Notice list: " + sw.Elapsed);

                    GlobalService.IsPasswordInput = false;

                    sw.Reset();
                    sw.Start();
                    GlobalService.DiscList = DiscUtil.PopulateDiscList();
                    sw.Stop();
                    Debug.WriteLine("Populate Disc List: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.Division = SystemUtil.GetDivision(GlobalService.User);
                    sw.Stop();
                    Debug.WriteLine("Get Division: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.AppsList = SystemUtil.AppsList();
                    sw.Stop();
                    Debug.WriteLine("Get Application list: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.DocumentList = new List <lists.DocumentList>();
                    sw.Stop();
                    Debug.WriteLine("Initialize Document List: " + sw.Elapsed);

                    sw.Reset();
                    sw.Start();
                    GlobalService.ContactList = ContactUtil.ContactList();
                    sw.Stop();
                    Debug.WriteLine("Load Contact List: " + sw.Elapsed);

                    GetSystemVersion();

                    UpdateCommon();

                    SharedUtil.UpdateEmptyShared();

                    SharedUtil.UpdateShared();

                    Login();

                    //DataUtil.SyncDataToServer();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message + ex.StackTrace);
                }
            }
            catch (ArgumentException ex)
            {
                File.WriteAllText(@"D:\Error.txt", ex.Message + ex.StackTrace);
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }