微软官方WP7入门指南:Visual Studio与Expression Blend实战

需积分: 10 1 下载量 161 浏览量 更新于2024-07-27 收藏 18.71MB PDF 举报
在这个"wp7微软官方训练"中,学员将跟随详细的指导进入Windows Phone(WP)开发的世界。该培训专注于使用Microsoft Visual Studio 2010 Express和Expression Blend这两个核心工具,旨在帮助初学者创建和测试Windows Phone 7应用程序。课程内容分为两个实践环节: 1. **实践1:利用Visual Studio 2010 Express** - **任务1**:引导学员在Visual Studio中建立一个基础的Windows Phone应用程序工程,熟悉项目结构和配置。 - **任务2**:通过Windows Phone Emulator进行应用程序的构建和测试,确保代码在模拟环境中运行正常。 - **任务3**:设计用户界面,包括布局和交互元素,使应用程序具有吸引力。 - **任务4**:学习如何处理用户界面事件,如按钮点击或触摸事件,实现基本功能响应。 - **任务5**:验证整个开发流程,确保代码质量和功能完整。 2. **实践2:使用Expression Blend设计用户体验 (UX)** - **任务1**:教授如何在Expression Blend中创建自定义UI组件,如按钮,以满足特定设计需求。 - **任务2**:学习如何添加视觉状态效果,提升控件的动态性和交互性。 - **任务3**:通过动画技术创建吸引人的横幅文本展示,增强用户体验。 - **任务4**:再次进行验证,确保设计符合Windows Phone的规范和用户体验标准。 通过这些步骤,学员不仅掌握了开发环境的使用,还了解到Windows Phone平台的优势,包括其支持高质量的应用和游戏开发、Visual Studio和Expression Blend的强大集成能力,以及通过Windows Phone Marketplace轻松分发应用程序的便利性。整个实验以经典“HelloWorld”应用为例,让开发者逐步掌握Windows Phone应用程序的创建和设计流程,从而开启在WP平台上的成功开发之旅。

帮我把下面一段C++代码改写成python代码:#include "Trade.h" #include "WPrice.h" #include <algorithm> double normalCDF(double x) // Phi(-∞, x) aka N(x) { return std::erfc(-x / std::sqrt(2)) / 2; //erfc()是互补误差函数,该返回值表示标准正态分布下var小于x的概率,即N(x) } CTrade::CTrade(double tick) : wp_bid(0.01), wp_ask(0.01), m_tick(tick), m_TimeRound(50) { newday(NULL); } CTrade::~CTrade() { } void CTrade::OnBook(const BTRec& btRec) { wp.setGamma(0.1); wp_bid = wp.getWP(&btRec.Bids); wp_ask = wp.getWP(&btRec.Asks); if (wp_mid > 0){ //wp_mid初始化为-1,仅遇到第一条BTRec记录时条件为false double wp_now = (wp_bid + wp_ask) / 2; //updated wp_mid int volume = btRec.volume; //volume between two orderbook records double ratio = normalCDF((wp_now - wp_mid) / (2 * m_tick)); //m_tick = tick = 0.2 double buyvolume = ratio*volume, sellvolume = (1 - ratio)*volume; m_TimeRound.update(buyvolume, sellvolume, btRec.rec_time.timestamp); //volume moving average if (mv_volume < 0) { mv_volume = volume; mv_buyvolume = buyvolume; } else{ mv_volume += 0.002*(volume - mv_volume); mv_buyvolume += 0.002*(buyvolume - mv_buyvolume); } // round trip volatility if (time_ini < 0 || btRec.rec_time.timestamp - time_ini >= time_scale){ if (time_ini>0){ double dp = wp_now - wp_ini; volatility += 0.05*(dp*dp - volatility); } time_scale = m_TimeRound.getTime() * 1000; //in milliseconds time_ini = btRec.rec_time.timestamp; wp_ini = wp_now; } } wp_mid = (wp_bid + wp_ask) / 2; } void CTrade::newday(const char* p) { wp_mid = -1; m_TimeRound.newday(p); volatility = 16 * m_tick*m_tick; time_slapse = -1, time_scale = -1, wp_ini = -1, time_ini = -1; mv_buyvolume = mv_volume = -1; }

2023-05-15 上传

优化这段代码:function [Rp,As] = freqzn(num,den,wp,ws,Rp,As,ftype) switch ftype case 1 % 低通 [H, w] = freqz(num, den); H = abs(H); wp_index = find(w >= wp, 1); ws_index = find(w >= ws, 1); Rp = -20*log10(H(wp_index)); As = -20*log10(max(H(ws_index:end))); case 2 % 高通 [H, w] = freqz(num, den); H = abs(H); wp_index = find(w >= wp, 1); ws_index = find(w >= ws, 1); Rp = -20*log10(H(ws_index)); As = -20*log10(max(H(1:wp_index))); case 3 % 带通 [H, w] = freqz(num, den); H = abs(H); wp_index1 = find(w >= wp(1), 1); wp_index2 = find(w >= wp(2), 1); ws_index1 = find(w >= ws(1), 1); ws_index2 = find(w >= ws(2), 1); Rp = -20*log10(min(H(wp_index1:wp_index2))); As = -20*log10(max([max(H(1:ws_index1)), max(H(ws_index2:end))])); case 4 % 带阻 [H, w] = freqz(num, den); H = abs(H); wp_index1 = find(w >= wp(1), 1); wp_index2 = find(w >= wp(2), 1); ws_index1 = find(w >= ws(1), 1); ws_index2 = find(w >= ws(2), 1); Rp = -20*log10(max(H(wp_index1:wp_index2))); As = -20*log10(max([max(H(1:ws_index1)), max(H(ws_index2:end))])); otherwise error('Unsupported filter type!'); end %绘制滤波器的幅频特性 [H, w] = freqz(num, den); H = abs(H); figure; plot(w/pi, H, 'b', 'linewidth', 1.5); hold on; plot([0, wp]/pi, [1, 1], 'r--', 'linewidth', 1.5); plot([ws, 1]/pi, [0, 0], 'r--', 'linewidth', 1.5); if ftype == 3 || ftype == 4 plot([wp(1), wp(1)]/pi, [0, 1], 'r--', 'linewidth', 1.5); plot([wp(2), wp(2)]/pi, [0, 1], 'r--', 'linewidth', 1.5); end hold off; grid on; xlabel('归一化频率/\pi'); ylabel('幅值'); title('数字滤波器幅频特性'); end

2023-06-09 上传